Explorar o código

Identify error type for email invite

Print appropriate error message depending on error type.
Achilleas Koutsou %!s(int64=6) %!d(string=hai) anos
pai
achega
7180a753c4
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      routes/repo/setting.go

+ 5 - 1
routes/repo/setting.go

@@ -398,7 +398,11 @@ func SettingsCollaborationPost(c *context.Context) {
 		u, err := inviteWithMail(c, email)
 		if err != nil {
 			log.Info("Problem with inviting user %q: %s", email, err)
-			c.Flash.Error(c.Tr("form.invite_email_blocked"))
+			if models.IsErrBlockedDomain(err) {
+				c.Flash.Error(c.Tr("form.invite_email_blocked"))
+			} else if models.IsErrEmailAlreadyUsed(err) {
+				c.Flash.Error(c.Tr("form.email_been_used"))
+			}
 			c.Redirect(setting.AppSubURL + c.Req.URL.Path)
 			return
 		}