Add option to allow extra domains in the auth cookie other than the one in base url (#39)
* Add CONFIG_ALLOWED_COOKIE_DOMAINS option * Apply suggestions from @BrunoBernardino --------- Co-authored-by: Bruno Bernardino <me@brunobernardino.com>
This commit is contained in:
@@ -20,6 +20,16 @@ export function isAppEnabled(app: 'news' | 'notes' | 'photos') {
|
||||
return enabledApps.includes(app);
|
||||
}
|
||||
|
||||
export function isCookieDomainAllowed(domain: string) {
|
||||
const allowedDomains = (Deno.env.get('CONFIG_ALLOWED_COOKIE_DOMAINS') || '').split(',') as typeof domain[];
|
||||
|
||||
if (allowedDomains.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return allowedDomains.includes(domain);
|
||||
}
|
||||
|
||||
export function isEmailEnabled() {
|
||||
const areEmailsAllowed = Deno.env.get('CONFIG_ENABLE_EMAILS') === 'true';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user