Explorar el Código

Identify error type for email invite

Print appropriate error message depending on error type.
Achilleas Koutsou hace 5 años
padre
commit
7180a753c4
Se han modificado 1 ficheros con 5 adiciones y 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
 		}