Skip to content

Commit 780056c

Browse files
committed
feat(admin): retrieve email from the user claims
1 parent f630f7c commit 780056c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

admin/app/routes/authentication/login-oidc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export default class LoginOidcRoute extends Route {
7676
const error = new JSONApiError(apiError.detail, apiError);
7777

7878
const shouldUserCreateAnAccount = error.code === 'SHOULD_VALIDATE_CGU';
79-
const { authenticationKey, email } = error.meta ?? {};
79+
const { authenticationKey, userClaims } = error.meta ?? {};
8080
if (shouldUserCreateAnAccount && authenticationKey) {
81-
return { shouldUserCreateAnAccount, authenticationKey, email, identityProviderSlug };
81+
return { shouldUserCreateAnAccount, authenticationKey, email: userClaims.email, identityProviderSlug };
8282
}
8383

8484
if (error.status === '403' && error.code === 'PIX_ADMIN_ACCESS_NOT_ALLOWED') {

admin/tests/unit/routes/authentication/login-oidc-test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ module('Unit | Route | login-oidc', function (hooks) {
164164
authenticationKey: 'key',
165165
givenName: 'Mélusine',
166166
familyName: 'TITEGOUTTE',
167-
email: 'melu@example.net',
167+
userClaims: {
168+
email: 'melu@example.net',
169+
},
168170
},
169171
},
170172
],

0 commit comments

Comments
 (0)