Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nextjs-app): unable to login to admin #6120

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/nextjs-app/src/config/next-auth.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ const oneDayInSeconds = 86_400;
/**
* @todo Remove this once oauth is ready
*/
const getStaticAllowedDemoAdminUser = (email: string, password: string) => {
const getStaticAllowedDemoAdminUser = (username: string, password: string) => {
const enableDemoAdminUser = serverRuntimeEnv.AUTH_ENABLE_DEMO_ADMIN_USER;

if (
enableDemoAdminUser &&
email === '[email protected]' &&
username === '[email protected]' &&
password === 'demo123'
) {
return {
id: '1',
name: 'admin',
email,
username,
role: 'admin',
image: undefined,
};
Expand All @@ -40,7 +40,7 @@ export const nextAuthConfig: NextAuthOptions = {
// e.g. domain, username, password, 2FA token, etc.
// You can pass any HTML attribute to the <input> tag through the object.
credentials: {
email: {
username: {
label: 'Email',
type: 'text',
placeholder: '[email protected]',
Expand All @@ -52,10 +52,10 @@ export const nextAuthConfig: NextAuthOptions = {
throw createHttpUnauthorized('Credentials not provided');
}

const { email, password } = credentials ?? {};
const { username, password } = credentials ?? {};
// @todo remove this when oauth provider is in place.
const staticAllowedDemoAdminUser = getStaticAllowedDemoAdminUser(
email,
username,
password
);
if (staticAllowedDemoAdminUser) return staticAllowedDemoAdminUser;
Expand Down
Loading