瀏覽代碼

Show error message when inviting blocked email

Achilleas Koutsou 5 年之前
父節點
當前提交
9efe0c8e94
共有 3 個文件被更改,包括 7 次插入5 次删除
  1. 1 0
      conf/locale/locale_en-GB.ini
  2. 1 0
      conf/locale/locale_en-US.ini
  3. 5 5
      routes/repo/setting.go

+ 1 - 0
conf/locale/locale_en-GB.ini

@@ -240,6 +240,7 @@ enterred_invalid_repo_name=Please make sure that the repository name you have en
 enterred_invalid_owner_name=Please make sure that the owner name you have entered is correct.
 enterred_invalid_password=Please make sure the that password you have entered is correct.
 user_not_exist=Given user does not exist.
+invite_email_blocked=User invitation failed. Please contact the site administrators.
 last_org_owner=Removing the last user from a owner team isn't allowed, as there must always be at least one owner in any given organisation.
 
 invalid_ssh_key=Sorry, we're not able to verify your SSH key: %s

+ 1 - 0
conf/locale/locale_en-US.ini

@@ -240,6 +240,7 @@ enterred_invalid_repo_name = Please make sure that the repository name you enter
 enterred_invalid_owner_name = Please make sure that the owner name you entered is correct.
 enterred_invalid_password = Please make sure the that password you entered is correct.
 user_not_exist = Given user does not exist.
+invite_email_blocked=User invitation failed. Please contact the site administrators.
 last_org_owner = Removing the last user from a owner team isn't allowed, as there must always be at least one owner in any given organization.
 
 invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s

+ 5 - 5
routes/repo/setting.go

@@ -393,12 +393,12 @@ func inviteWithMail(c *context.Context, mail string) (*models.User, error) {
 }
 func SettingsCollaborationPost(c *context.Context) {
 	var name string
-	new := strings.ToLower(c.Query("invite"))
-	if len(new) > 0 {
-		u, err := inviteWithMail(c, new)
+	email := strings.ToLower(c.Query("invite"))
+	if len(email) > 0 {
+		u, err := inviteWithMail(c, email)
 		if err != nil {
-			log.Info("Problem with inviting user:%s, %+v", new, err)
-			c.Flash.Error(c.Tr("form.user_not_invitable"))
+			log.Info("Problem with inviting user %q: %s", email, err)
+			c.Flash.Error(c.Tr("form.invite_email_blocked"))
 			c.Redirect(setting.AppSubURL + c.Req.URL.Path)
 			return
 		}