added authorization hd
This commit is contained in:
@@ -32,6 +32,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||
authorizationParams() {
|
||||
return {
|
||||
prompt: 'select_account',
|
||||
hd: 'pcpuma.acatlan.unam.mx',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,6 +46,13 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||
try {
|
||||
const email = profile.emails?.[0]?.value || '';
|
||||
|
||||
if (!email.endsWith('@pcpuma.acatlan.unam.mx')) {
|
||||
return done(
|
||||
new Error('El correo no pertenece al dominio permitido'),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
const user = await this.personaService.validateOrCreateGoogleUser({
|
||||
email,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user