added authorization hd

This commit is contained in:
2025-10-24 19:48:53 -06:00
parent 549d0645aa
commit aae6cb8704
@@ -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,
});