mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
Fix github oauth (#5729)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
0afcc2cdfe
commit
4a229eb671
@ -42,10 +42,10 @@ export function registerGithub (
|
||||
redirectURL,
|
||||
passport.authenticate('github', { failureRedirect: concatLink(frontUrl, '/login'), session: true }),
|
||||
async (ctx, next) => {
|
||||
const email = ctx.state.user.emails?.[0]?.value ?? `github:${ctx.state.user.username}`
|
||||
const [first, last] = ctx.state.user.displayName.split(' ')
|
||||
if (email !== undefined) {
|
||||
try {
|
||||
try {
|
||||
const email = ctx.state.user.emails?.[0]?.value ?? `github:${ctx.state.user.username}`
|
||||
const [first, last] = ctx.state.user.displayName?.split(' ') ?? [ctx.state.user.username, '']
|
||||
if (email !== undefined) {
|
||||
if (ctx.query?.state != null) {
|
||||
const loginInfo = await joinWithProvider(
|
||||
measureCtx,
|
||||
@ -73,9 +73,9 @@ export function registerGithub (
|
||||
}
|
||||
// Successful authentication, redirect to your application
|
||||
ctx.redirect(concatLink(frontUrl, '/login/auth'))
|
||||
} catch (err: any) {
|
||||
measureCtx.error('failed to auth', err)
|
||||
}
|
||||
} catch (err: any) {
|
||||
measureCtx.error('failed to auth', err)
|
||||
}
|
||||
await next()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user