From 18033f49ba8f00695dd9f885360664a383610df1 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 15 Mar 2022 01:39:54 +0800 Subject: Restrict email address validation (#17688) This didn't follow the RFC but it's a subset of that. I think we should narrow the allowed chars at first and discuss more possibility in future PRs. --- routers/web/user/setting/account.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'routers/web/user') diff --git a/routers/web/user/setting/account.go b/routers/web/user/setting/account.go index b73122fa12..492b4f82c8 100644 --- a/routers/web/user/setting/account.go +++ b/routers/web/user/setting/account.go @@ -188,7 +188,8 @@ func EmailPost(ctx *context.Context) { ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSettingsAccount, &form) return - } else if user_model.IsErrEmailInvalid(err) { + } else if user_model.IsErrEmailCharIsNotSupported(err) || + user_model.IsErrEmailInvalid(err) { loadAccountData(ctx) ctx.RenderWithErr(ctx.Tr("form.email_invalid"), tplSettingsAccount, &form) -- cgit v1.2.3