MagicLinkAuthMethod: do not allow register for already existing email
This commit is contained in:
parent
c08d03c8fb
commit
683fe7262b
@ -11,6 +11,7 @@ import RedirectBackComponent from "../../components/RedirectBackComponent";
|
||||
import Application from "../../Application";
|
||||
import {MailTemplate} from "../../mail/Mail";
|
||||
import AuthMagicLinkActionType from "./AuthMagicLinkActionType";
|
||||
import Validator from "../../db/Validator";
|
||||
|
||||
export default class MagicLinkAuthMethod implements AuthMethod<MagicLink> {
|
||||
public constructor(
|
||||
@ -75,6 +76,12 @@ export default class MagicLinkAuthMethod implements AuthMethod<MagicLink> {
|
||||
const geo = geoip.lookup(req.ip);
|
||||
const actionType = isRegistration ? AuthMagicLinkActionType.REGISTER : AuthMagicLinkActionType.LOGIN;
|
||||
|
||||
if (isRegistration) {
|
||||
await Validator.validate({
|
||||
email: new Validator().defined().unique(UserEmail, 'email'),
|
||||
}, {email: email});
|
||||
}
|
||||
|
||||
await MagicLinkController.sendMagicLink(
|
||||
this.app,
|
||||
req.getSession().id,
|
||||
|
Loading…
Reference in New Issue
Block a user