]> source.dussan.org Git - gitea.git/commitdiff
Validate email in oauth registration form (#15014)
authorKyle D <kdumontnu@gmail.com>
Wed, 17 Mar 2021 03:54:02 +0000 (21:54 -0600)
committerGitHub <noreply@github.com>
Wed, 17 Mar 2021 03:54:02 +0000 (04:54 +0100)
routers/user/auth.go

index e5e8cc1151f8374ce1c644e546d0b2e2c15a43fc..37181c68e7a248984406b1378a72b805cc6abd1c 100644 (file)
@@ -942,6 +942,11 @@ func LinkAccountPostRegister(ctx *context.Context) {
                }
        }
 
+       if !form.IsEmailDomainAllowed() {
+               ctx.RenderWithErr(ctx.Tr("auth.email_domain_blacklisted"), tplLinkAccount, &form)
+               return
+       }
+
        if setting.Service.AllowOnlyExternalRegistration || !setting.Service.RequireExternalRegistrationPassword {
                // In models.User an empty password is classed as not set, so we set form.Password to empty.
                // Eventually the database should be changed to indicate "Second Factor"-enabled accounts