issue-129 Add custom auth ui/ux

This commit is contained in:
Kurt Hutten
2020-12-03 06:55:26 +11:00
parent 8379b03537
commit fc4906757a
23 changed files with 548 additions and 26 deletions

View File

@@ -18,7 +18,7 @@ export const handler = async (req, _context) => {
email: 'k.hutten@protonmail.ch',
confirmation_sent_at: '2020-10-19T18:09:01Z',
app_metadata: { provider: 'email' },
user_metadata: { full_name: 'sick_dog' },
user_metadata: { full_name: 'sick_dog', userName: 'hi bob' },
created_at: '2020-10-19T18:09:01Z',
updated_at: '2020-10-19T18:09:01Z'
}
@@ -62,12 +62,12 @@ export const handler = async (req, _context) => {
db.user.findOne({
where: { userName: seed },
})
const userNameSeed = enforceAlphaNumeric(email.split('@')[0])
const userNameSeed = enforceAlphaNumeric(user?.user_metadata?.userName)
const userName = await generateUniqueString(userNameSeed, isUniqueCallback) // TODO maybe come up with a better default userName?
const input = {
email,
userName,
name: user.user_metadata && user.user_metadata.full_name,
name: user?.user_metadata?.full_name,
id: user.id,
}
await createUserInsecure({ input })