Add local authentication option (#37)
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m20s
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m20s
Co-authored-by: Shaun Campbell <shaun@campbellwireless.net> Reviewed-on: #37 Co-authored-by: AI Agent <ai-agent@campbellwireless.net> Co-committed-by: AI Agent <ai-agent@campbellwireless.net>
This commit was merged in pull request #37.
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
import { env } from '$env/dynamic/private';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
const resolveErrorMessage = (value: string | null): string | null => {
|
||||
if (!value) return null;
|
||||
if (value === 'CredentialsSignin') return 'Invalid credentials';
|
||||
return null;
|
||||
};
|
||||
|
||||
export const load: PageServerLoad = async ({ url }) => {
|
||||
const authUrl = process.env.AUTH_URL ?? env.AUTH_URL ?? '';
|
||||
const localAuthEnabled = (process.env.LOCAL_AUTH_ENABLED ?? env.LOCAL_AUTH_ENABLED) === 'true';
|
||||
|
||||
return {
|
||||
signinUrl: `${env.AUTH_URL}/signin/synology`
|
||||
signinUrl: `${authUrl}/signin/synology`,
|
||||
localSigninUrl: `${authUrl}/signin/local`,
|
||||
localAuthEnabled,
|
||||
error: resolveErrorMessage(url.searchParams.get('error'))
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user