Skip to content

Conversation

@ndom91
Copy link
Member

@ndom91 ndom91 commented Sep 18, 2021

Reasoning 💡

Add some very minimal customisation to the built-in signin page so people might not immediately need to replace it. This way they can customise some things with their brand color and add their company / project logo just above the card with the signin buttons. We explicitly do not want to go overboard styling this page. This is not an authentication component library or next.js app template!

Example:

export default NextAuth({
  providers: [...],
  jwt: {...},
  theme: {
    colorScheme: 'auto',
    brandColor: '#67b246',
    logo: 'https://company.com/assets/logo.png'
  }
})

Would generate this:

Signin:
image
image

Signout:
image
image

Error:
image
image

Verify Request:
image
image

What do yall think?

Checklist 🧢

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2021

Codecov Report

Merging #2788 (32628d2) into beta (a2c4046) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             beta    #2788      +/-   ##
==========================================
- Coverage   14.23%   14.21%   -0.03%     
==========================================
  Files          85       85              
  Lines        1342     1344       +2     
  Branches      380      386       +6     
==========================================
  Hits          191      191              
- Misses       1081     1083       +2     
  Partials       70       70              
Impacted Files Coverage Δ
src/server/index.ts 0.00% <ø> (ø)
src/server/pages/error.tsx 0.00% <0.00%> (ø)
src/server/pages/index.ts 0.00% <ø> (ø)
src/server/pages/signin.tsx 0.00% <0.00%> (ø)
src/server/pages/signout.tsx 0.00% <0.00%> (ø)
src/server/pages/verify-request.tsx 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2c4046...32628d2. Read the comment docs.

@balazsorban44
Copy link
Member

balazsorban44 commented Sep 18, 2021

I really like the idea! The other pages would benefit from this as well, I think. See: https://github.com/nextauthjs/next-auth/tree/beta/src/server/pages

I don't think we need individual configuration for each page, just stretch the color and logo across all of them.

From your example screenshot I cannot decide if the placeholder for password is not visible because of a CSS bug, or you simply don't have a placeholder text?

@ndom91
Copy link
Member Author

ndom91 commented Sep 19, 2021

Yeah good call, will reuse those values across the other pages and update this PR tomorrow 👍

Regarding the Credentials placeholder, it's empty in fact. If you don't specify a placeholder value in the config, which we dont in the example dev app

placeholder={
provider.credentials[credential].placeholder || ""
}

CredentialsProvider({
name: "Credentials",
credentials: {
password: { label: "Password", type: "password" },
},

image

@ndom91
Copy link
Member Author

ndom91 commented Sep 19, 2021

@balazsorban44 alright so I themed the rest of the pages. I also made the fallback Credentials placeholder be "Password", I think thats a safe bet for that field, right?

I didn't find a good use for the brandColor on other pages though..

Do you like the border of the card being in the brandColor?

image
image

Doesn't look so bad with this green, but I can imagine it wouldn't be so nice with other colors.

@ndom91 ndom91 marked this pull request as ready for review September 19, 2021 15:45
@balazsorban44
Copy link
Member

Docs will have to be upgraded:

https://github.com/nextauthjs/docs/blob/main/docs/configuration/options.md#theme

https://github.com/nextauthjs/docs/blob/main/docs/configuration/pages.md#theming

@ndom91
Copy link
Member Author

ndom91 commented Sep 19, 2021

Theme docs PR: nextauthjs/docs#35

@balazsorban44 balazsorban44 self-requested a review September 19, 2021 22:46
Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@balazsorban44 balazsorban44 changed the title feat: signin page theme updates feat: built-in page theme updates Sep 19, 2021
@balazsorban44 balazsorban44 merged commit cabcdc9 into beta Sep 19, 2021
@balazsorban44 balazsorban44 deleted the ndom91/login-page branch September 19, 2021 22:48
@leon-do
Copy link

leon-do commented Feb 5, 2023

colorScheme works great but I"m unable to get logo.

Is there an example repo with logo?

@alsherif-khalaf
Copy link

heme: {
    colorScheme: 'auto',
    brandColor: '#67b246',
    logo: 'https://company.com/assets/logo.png'
  }

yes the same problem with me , no logo

mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
Add some very minimal customization to the built-in pages so people might not immediately need to replace them. This way they can customize some things with their brand color and add their company/project logo. We explicitly **do not** want to go overboard styling this page. This is not an authentication component library or Next.js app template!

Example:
```js
export default NextAuth({
  providers: [...],
  jwt: {...},
  theme: {
    colorScheme: 'auto',
    brandColor: '#67b246',
    logo: 'https://company.com/assets/logo.png'
  }
})
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Refers to `@auth/core` pages style

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants