Просмотр исходного кода

Fixed GoStandards in user routes

Yoginth 7 лет назад
Родитель
Сommit
dd14eb2cc0
7 измененных файлов с 150 добавлено и 94 удалено
  1. 1 1
      routes/home.go
  2. 47 34
      routes/user/auth.go
  3. 3 2
      routes/user/certificate.go
  4. 3 2
      routes/user/embed.go
  5. 18 9
      routes/user/home.go
  6. 8 5
      routes/user/profile.go
  7. 70 41
      routes/user/setting.go

+ 1 - 1
routes/home.go

@@ -22,7 +22,7 @@ func Home(c *context.Context) {
 	if c.IsLogged {
 		if !c.User.IsActive && setting.Service.RegisterEmailConfirm {
 			c.Data["Title"] = c.Tr("auth.active_your_account")
-			c.Success(user.ACTIVATE)
+			c.Success(user.ActivateTPL)
 		} else {
 			user.Dashboard(c)
 		}

+ 47 - 34
routes/user/auth.go

@@ -23,13 +23,26 @@ import (
 )
 
 const (
-	LOGIN                    = "user/auth/login"
-	TWO_FACTOR               = "user/auth/two_factor"
-	TWO_FACTOR_RECOVERY_CODE = "user/auth/two_factor_recovery_code"
-	SIGNUP                   = "user/auth/signup"
-	ACTIVATE                 = "user/auth/activate"
-	FORGOT_PASSWORD          = "user/auth/forgot_passwd"
-	RESET_PASSWORD           = "user/auth/reset_passwd"
+	// LoginTPL page template
+	LoginTPL = "user/auth/login"
+
+	// TwoFactorTPL page template
+	TwoFactorTPL = "user/auth/two_factor"
+
+	// TwoFactorRecoveryCodeTPL page template
+	TwoFactorRecoveryCodeTPL = "user/auth/two_factor_recovery_code"
+
+	// SignupTPL page template
+	SignupTPL = "user/auth/signup"
+
+	// ActivateTPL page template
+	ActivateTPL = "user/auth/activate"
+
+	// ForgotPasswordTPL page template
+	ForgotPasswordTPL = "user/auth/forgot_passwd"
+
+	// ResetPasswordTPL page template
+	ResetPasswordTPL = "user/auth/reset_passwd"
 )
 
 // AutoLogin reads cookie and try to auto-login.
@@ -121,7 +134,7 @@ func Login(c *context.Context) {
 		}
 	}
 
-	c.Success(LOGIN)
+	c.Success(LoginTPL)
 }
 
 //afterLogin set sessions cookies and redirect to "/"
@@ -165,7 +178,7 @@ func LoginPost(c *context.Context, f form.SignIn) {
 	c.Data["LoginSources"] = loginSources
 
 	if c.HasError() {
-		c.Success(LOGIN)
+		c.Success(LoginTPL)
 		return
 	}
 
@@ -174,10 +187,10 @@ func LoginPost(c *context.Context, f form.SignIn) {
 		switch err.(type) {
 		case errors.UserNotExist:
 			c.FormErr("UserName", "Password")
-			c.RenderWithErr(c.Tr("form.username_password_incorrect"), LOGIN, &f)
+			c.RenderWithErr(c.Tr("form.username_password_incorrect"), LoginTPL, &f)
 		case errors.LoginSourceMismatch:
 			c.FormErr("LoginSource")
-			c.RenderWithErr(c.Tr("form.auth_source_mismatch"), LOGIN, &f)
+			c.RenderWithErr(c.Tr("form.auth_source_mismatch"), LoginTPL, &f)
 
 		default:
 			c.ServerError("UserLogin", err)
@@ -214,7 +227,7 @@ func LoginTwoFactor(c *context.Context) {
 		return
 	}
 
-	c.Success(TWO_FACTOR)
+	c.Success(TwoFactorTPL)
 }
 
 //LoginTwoFactorPost is the POST handler for "/login" with two factors authentication
@@ -270,7 +283,7 @@ func LoginTwoFactorRecoveryCode(c *context.Context) {
 		return
 	}
 
-	c.Success(TWO_FACTOR_RECOVERY_CODE)
+	c.Success(TwoFactorRecoveryCodeTPL)
 }
 
 //LoginTwoFactorRecoveryCodePost is the POST handler to recover Two Factor Code
@@ -317,11 +330,11 @@ func SignUp(c *context.Context) {
 
 	if setting.Service.DisableRegistration {
 		c.Data["DisableRegistration"] = true
-		c.Success(SIGNUP)
+		c.Success(SignupTPL)
 		return
 	}
 
-	c.Success(SIGNUP)
+	c.Success(SignupTPL)
 }
 
 //SignUpPost is the POST handler for "/join"
@@ -336,19 +349,19 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 	}
 
 	if c.HasError() {
-		c.Success(SIGNUP)
+		c.Success(SignupTPL)
 		return
 	}
 
 	if setting.Service.EnableCaptcha && !cpt.VerifyReq(c.Req) {
 		c.FormErr("Captcha")
-		c.RenderWithErr(c.Tr("form.captcha_incorrect"), SIGNUP, &f)
+		c.RenderWithErr(c.Tr("form.captcha_incorrect"), SignupTPL, &f)
 		return
 	}
 
 	if f.Password != f.Retype {
 		c.FormErr("Password")
-		c.RenderWithErr(c.Tr("form.password_not_match"), SIGNUP, &f)
+		c.RenderWithErr(c.Tr("form.password_not_match"), SignupTPL, &f)
 		return
 	}
 
@@ -364,16 +377,16 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 		switch {
 		case models.IsErrUserAlreadyExist(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("form.username_been_taken"), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("form.username_been_taken"), SignupTPL, &f)
 		case models.IsErrEmailAlreadyUsed(err):
 			c.FormErr("Email")
-			c.RenderWithErr(c.Tr("form.email_been_used"), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SignupTPL, &f)
 		case models.IsErrNameReserved(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("user.form.name_reserved", err.(models.ErrNameReserved).Name), SignupTPL, &f)
 		case models.IsErrNamePatternNotAllowed(err):
 			c.FormErr("UserName")
-			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SIGNUP, &f)
+			c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SignupTPL, &f)
 		default:
 			c.ServerError("CreateUser", err)
 		}
@@ -400,7 +413,7 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
 		c.Data["IsSendRegisterMail"] = true
 		c.Data["Email"] = u.Email
 		c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
-		c.Success(ACTIVATE)
+		c.Success(ActivateTPL)
 
 		if err := c.Cache.Put(u.MailResendCacheKey(), 1, 180); err != nil {
 			raven.CaptureErrorAndWait(err, nil)
@@ -437,7 +450,7 @@ func Activate(c *context.Context) {
 		} else {
 			c.Data["ServiceNotEnabled"] = true
 		}
-		c.Success(ACTIVATE)
+		c.Success(ActivateTPL)
 		return
 	}
 
@@ -463,7 +476,7 @@ func Activate(c *context.Context) {
 	}
 
 	c.Data["IsActivateFailed"] = true
-	c.Success(ACTIVATE)
+	c.Success(ActivateTPL)
 }
 
 //ActivateEmail is the handler to activate the user email
@@ -491,12 +504,12 @@ func ForgotPasswd(c *context.Context) {
 
 	if setting.MailService == nil {
 		c.Data["IsResetDisable"] = true
-		c.Success(FORGOT_PASSWORD)
+		c.Success(ForgotPasswordTPL)
 		return
 	}
 
 	c.Data["IsResetRequest"] = true
-	c.Success(FORGOT_PASSWORD)
+	c.Success(ForgotPasswordTPL)
 }
 
 //ForgotPasswdPost is the POST handler for "/user/forget_password"
@@ -517,7 +530,7 @@ func ForgotPasswdPost(c *context.Context) {
 		if errors.IsUserNotExist(err) {
 			c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
 			c.Data["IsResetSent"] = true
-			c.Success(FORGOT_PASSWORD)
+			c.Success(ForgotPasswordTPL)
 			return
 		} else {
 			c.ServerError("GetUserByEmail", err)
@@ -527,13 +540,13 @@ func ForgotPasswdPost(c *context.Context) {
 
 	if !u.IsLocal() {
 		c.FormErr("Email")
-		c.RenderWithErr(c.Tr("auth.non_local_account"), FORGOT_PASSWORD, nil)
+		c.RenderWithErr(c.Tr("auth.non_local_account"), ForgotPasswordTPL, nil)
 		return
 	}
 
 	if c.Cache.IsExist(u.MailResendCacheKey()) {
 		c.Data["ResendLimited"] = true
-		c.Success(FORGOT_PASSWORD)
+		c.Success(ForgotPasswordTPL)
 		return
 	}
 
@@ -545,7 +558,7 @@ func ForgotPasswdPost(c *context.Context) {
 
 	c.Data["Hours"] = setting.Service.ActiveCodeLives / 60
 	c.Data["IsResetSent"] = true
-	c.Success(FORGOT_PASSWORD)
+	c.Success(ForgotPasswordTPL)
 }
 
 //ResetPasswd is the handler to reset your password
@@ -559,7 +572,7 @@ func ResetPasswd(c *context.Context) {
 	}
 	c.Data["Code"] = code
 	c.Data["IsResetForm"] = true
-	c.Success(RESET_PASSWORD)
+	c.Success(ResetPasswordTPL)
 }
 
 //ResetPasswdPost is the POST handler to reset your password
@@ -579,7 +592,7 @@ func ResetPasswdPost(c *context.Context) {
 		if len(passwd) < 6 {
 			c.Data["IsResetForm"] = true
 			c.Data["Err_Password"] = true
-			c.RenderWithErr(c.Tr("auth.password_too_short"), RESET_PASSWORD, nil)
+			c.RenderWithErr(c.Tr("auth.password_too_short"), ResetPasswordTPL, nil)
 			return
 		}
 
@@ -605,5 +618,5 @@ func ResetPasswdPost(c *context.Context) {
 	}
 
 	c.Data["IsResetFailed"] = true
-	c.Success(RESET_PASSWORD)
+	c.Success(ResetPasswordTPL)
 }

+ 3 - 2
routes/user/certificate.go

@@ -12,12 +12,13 @@ import (
 )
 
 const (
-	INTERNCERTIFICATE = "misc/internscert"
+	// InterCertificateTPL page template
+	InterCertificateTPL = "misc/internscert"
 )
 
 func InternCertificate(c *context.Context) {
 	ctxUser := GetUserByName(c, strings.TrimSuffix(c.Params(":username"), ""))
 	c.Data["Owner"] = ctxUser
 
-	c.HTML(200, INTERNCERTIFICATE)
+	c.HTML(200, InterCertificateTPL)
 }

+ 3 - 2
routes/user/embed.go

@@ -12,12 +12,13 @@ import (
 )
 
 const (
-	EMBED = "embed/user"
+	// EmbedTPL page template
+	EmbedTPL = "embed/user"
 )
 
 func Embed(c *context.Context) {
 	ctxUser := GetUserByName(c, strings.TrimSuffix(c.Params(":username"), ""))
 	c.Data["Owner"] = ctxUser
 
-	c.HTML(200, EMBED)
+	c.HTML(200, EmbedTPL)
 }

+ 18 - 9
routes/user/home.go

@@ -19,11 +19,20 @@ import (
 )
 
 const (
-	DASHBOARD = "user/dashboard/dashboard"
-	NEWS_FEED = "user/dashboard/feeds"
-	ISSUES    = "user/dashboard/issues"
-	PROFILE   = "user/profile"
-	ORG_HOME  = "org/home"
+	// DashboardTPL page template
+	DashboardTPL = "user/dashboard/dashboard"
+
+	// NewsFeedTPL page template
+	NewsFeedTPL = "user/dashboard/feeds"
+
+	// IssuesTPL page template
+	IssuesTPL = "user/dashboard/issues"
+
+	// ProfileTPL page template
+	ProfileTPL = "user/profile"
+
+	// OrgHomeTPL page template
+	OrgHomeTPL = "org/home"
 )
 
 // getDashboardContextUser finds out dashboard is viewing as which context user.
@@ -101,7 +110,7 @@ func Dashboard(c *context.Context) {
 	}
 
 	if c.Req.Header.Get("X-AJAX") == "true" {
-		c.HTML(200, NEWS_FEED)
+		c.HTML(200, NewsFeedTPL)
 		return
 	}
 
@@ -163,7 +172,7 @@ func Dashboard(c *context.Context) {
 	c.Data["MirrorCount"] = len(mirrors)
 	c.Data["Mirrors"] = mirrors
 
-	c.HTML(200, DASHBOARD)
+	c.HTML(200, DashboardTPL)
 }
 
 func Issues(c *context.Context) {
@@ -343,7 +352,7 @@ func Issues(c *context.Context) {
 		c.Data["State"] = "open"
 	}
 
-	c.HTML(200, ISSUES)
+	c.HTML(200, IssuesTPL)
 }
 
 func ShowSSHKeys(c *context.Context, uid int64) {
@@ -413,7 +422,7 @@ func showOrgProfile(c *context.Context) {
 
 	c.Data["Teams"] = org.Teams
 	c.Data["PageIsOrgHome"] = true
-	c.HTML(200, ORG_HOME)
+	c.HTML(200, OrgHomeTPL)
 }
 
 func Email2User(c *context.Context) {

+ 8 - 5
routes/user/profile.go

@@ -20,8 +20,11 @@ import (
 )
 
 const (
-	FOLLOWERS = "user/meta/followers"
-	STARS     = "user/meta/stars"
+	// FollowersTPL page template
+	FollowersTPL = "user/meta/followers"
+
+	// StarsTPL page template
+	StarsTPL = "user/meta/stars"
 )
 
 func GetUserByName(c *context.Context, name string) *models.User {
@@ -94,7 +97,7 @@ func Profile(c *context.Context, puser *context.ParamsUser) {
 	if puser.Suspended == true {
 		c.Handle(404, "Suspended", err)
 	} else {
-		c.Success(PROFILE)
+		c.Success(ProfileTPL)
 	}
 }
 
@@ -103,7 +106,7 @@ func Followers(c *context.Context, puser *context.ParamsUser) {
 	c.PageIs("Followers")
 	c.Data["CardsTitle"] = c.Tr("user.followers")
 	c.Data["Owner"] = puser
-	repo.RenderUserCards(c, puser.NumFollowers, puser.GetFollowers, FOLLOWERS)
+	repo.RenderUserCards(c, puser.NumFollowers, puser.GetFollowers, FollowersTPL)
 }
 
 func Following(c *context.Context, puser *context.ParamsUser) {
@@ -111,7 +114,7 @@ func Following(c *context.Context, puser *context.ParamsUser) {
 	c.PageIs("Following")
 	c.Data["CardsTitle"] = c.Tr("user.following")
 	c.Data["Owner"] = puser
-	repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FOLLOWERS)
+	repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FollowersTPL)
 }
 
 func Stars(c *context.Context) {

+ 70 - 41
routes/user/setting.go

@@ -30,21 +30,50 @@ import (
 )
 
 const (
-	SETTINGS_PROFILE                   = "user/settings/profile"
-	SETTINGS_SOCIAL                    = "user/settings/social"
-	SETTINGS_AVATAR                    = "user/settings/avatar"
-	SETTINGS_PASSWORD                  = "user/settings/password"
-	SETTINGS_EMAILS                    = "user/settings/email"
-	SETTINGS_SSH_KEYS                  = "user/settings/sshkeys"
-	SETTINGS_SECURITY                  = "user/settings/security"
-	SETTINGS_TWO_FACTOR_ENABLE         = "user/settings/two_factor_enable"
-	SETTINGS_TWO_FACTOR_RECOVERY_CODES = "user/settings/two_factor_recovery_codes"
-	SETTINGS_REPOSITORIES              = "user/settings/repositories"
-	SETTINGS_ORGANIZATIONS             = "user/settings/organizations"
-	SETTINGS_APPLICATIONS              = "user/settings/applications"
-	SETTINGS_EMBEDS                    = "user/settings/embeds"
-	SETTINGS_DELETE                    = "user/settings/delete"
-	NOTIFICATION                       = "user/notification"
+	// SettingsProfileTPL page template
+	SettingsProfileTPL = "user/settings/profile"
+
+	// SettingsSocialTPL page template
+	SettingsSocialTPL = "user/settings/social"
+
+	// SettingsAvatarTPL page template
+	SettingsAvatarTPL = "user/settings/avatar"
+
+	// SettingsPasswordTPL page template
+	SettingsPasswordTPL = "user/settings/password"
+
+	// SettingsEmailsTPL page template
+	SettingsEmailsTPL = "user/settings/email"
+
+	// SettingsSSHKeysTPL page template
+	SettingsSSHKeysTPL = "user/settings/sshkeys"
+
+	// SettingsSecurityTPL page template
+	SettingsSecurityTPL = "user/settings/security"
+
+	// SettingsTwoFactorEnableTPL page template
+	SettingsTwoFactorEnableTPL = "user/settings/two_factor_enable"
+
+	// SettingsTwoFactorRecoveryCodesTPL page template
+	SettingsTwoFactorRecoveryCodesTPL = "user/settings/two_factor_recovery_codes"
+
+	// SettingsRepositoriesTPL page template
+	SettingsRepositoriesTPL = "user/settings/repositories"
+
+	// SettingsOrganizationsTPL page template
+	SettingsOrganizationsTPL = "user/settings/organizations"
+
+	// SettingsApplicationsTPL page template
+	SettingsApplicationsTPL = "user/settings/applications"
+
+	// SettingsEmbedsTPL page template
+	SettingsEmbedsTPL = "user/settings/embeds"
+
+	// SettingsDeleteTPL page template
+	SettingsDeleteTPL = "user/settings/delete"
+
+	// NotificationTPL page template
+	NotificationTPL = "user/notification"
 )
 
 func Settings(c *context.Context) {
@@ -65,7 +94,7 @@ func Settings(c *context.Context) {
 	c.Data["show_ads"] = c.User.ShowAds
 	c.Data["private_email"] = c.User.PrivateEmail
 	c.Data["private_profile"] = c.User.PrivateProfile
-	c.Success(SETTINGS_PROFILE)
+	c.Success(SettingsProfileTPL)
 }
 
 func SettingsPost(c *context.Context, f form.UpdateProfile) {
@@ -74,7 +103,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	c.Data["origin_name"] = c.User.Name
 
 	if c.HasError() {
-		c.Success(SETTINGS_PROFILE)
+		c.Success(SettingsProfileTPL)
 		return
 	}
 
@@ -97,7 +126,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 					return
 				}
 
-				c.RenderWithErr(msg, SETTINGS_PROFILE, &f)
+				c.RenderWithErr(msg, SettingsProfileTPL, &f)
 				return
 			}
 
@@ -113,7 +142,7 @@ func SettingsPost(c *context.Context, f form.UpdateProfile) {
 	if c.User.Email != email {
 		if used, err := models.IsEmailUsed(email); used {
 			c.FormErr("Email")
-			c.RenderWithErr(c.Tr("form.email_been_used"), SETTINGS_PROFILE, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SettingsProfileTPL, &f)
 			return
 		} else if err != nil {
 			c.ServerError("ChangeUserName", err)
@@ -156,7 +185,7 @@ func SettingsSocial(c *context.Context) {
 	c.Data["telegram"] = c.User.Telegram
 	c.Data["codepen"] = c.User.Codepen
 	c.Data["gitlab"] = c.User.Gitlab
-	c.Success(SETTINGS_SOCIAL)
+	c.Success(SettingsSocialTPL)
 }
 
 func SettingsSocialPost(c *context.Context, f form.UpdateSocial) {
@@ -165,7 +194,7 @@ func SettingsSocialPost(c *context.Context, f form.UpdateSocial) {
 	c.Data["origin_name"] = c.User.Name
 
 	if c.HasError() {
-		c.Success(SETTINGS_SOCIAL)
+		c.Success(SettingsSocialTPL)
 		return
 	}
 
@@ -233,7 +262,7 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxUser *models.User
 func SettingsAvatar(c *context.Context) {
 	c.Title("settings.avatar")
 	c.PageIs("SettingsAvatar")
-	c.Success(SETTINGS_AVATAR)
+	c.Success(SettingsAvatarTPL)
 }
 
 func SettingsAvatarPost(c *context.Context, f form.Avatar) {
@@ -257,7 +286,7 @@ func SettingsDeleteAvatar(c *context.Context) {
 func SettingsPassword(c *context.Context) {
 	c.Title("settings.password")
 	c.PageIs("SettingsPassword")
-	c.Success(SETTINGS_PASSWORD)
+	c.Success(SettingsPasswordTPL)
 }
 
 func SettingsPasswordPost(c *context.Context, f form.ChangePassword) {
@@ -265,7 +294,7 @@ func SettingsPasswordPost(c *context.Context, f form.ChangePassword) {
 	c.PageIs("SettingsPassword")
 
 	if c.HasError() {
-		c.Success(SETTINGS_PASSWORD)
+		c.Success(SettingsPasswordTPL)
 		return
 	}
 
@@ -302,7 +331,7 @@ func SettingsEmails(c *context.Context) {
 	}
 	c.Data["Emails"] = emails
 
-	c.Success(SETTINGS_EMAILS)
+	c.Success(SettingsEmailsTPL)
 }
 
 func SettingsEmailPost(c *context.Context, f form.AddEmail) {
@@ -329,7 +358,7 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
 	c.Data["Emails"] = emails
 
 	if c.HasError() {
-		c.Success(SETTINGS_EMAILS)
+		c.Success(SettingsEmailsTPL)
 		return
 	}
 
@@ -340,7 +369,7 @@ func SettingsEmailPost(c *context.Context, f form.AddEmail) {
 	}
 	if err := models.AddEmailAddress(email); err != nil {
 		if models.IsErrEmailAlreadyUsed(err) {
-			c.RenderWithErr(c.Tr("form.email_been_used"), SETTINGS_EMAILS, &f)
+			c.RenderWithErr(c.Tr("form.email_been_used"), SettingsEmailsTPL, &f)
 		} else {
 			c.ServerError("AddEmailAddress", err)
 		}
@@ -389,7 +418,7 @@ func SettingsSSHKeys(c *context.Context) {
 	}
 	c.Data["Keys"] = keys
 
-	c.Success(SETTINGS_SSH_KEYS)
+	c.Success(SettingsSSHKeysTPL)
 }
 
 func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
@@ -404,7 +433,7 @@ func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
 	c.Data["Keys"] = keys
 
 	if c.HasError() {
-		c.Success(SETTINGS_SSH_KEYS)
+		c.Success(SettingsSSHKeysTPL)
 		return
 	}
 
@@ -424,10 +453,10 @@ func SettingsSSHKeysPost(c *context.Context, f form.AddSSHKey) {
 		switch {
 		case models.IsErrKeyAlreadyExist(err):
 			c.FormErr("Content")
-			c.RenderWithErr(c.Tr("settings.ssh_key_been_used"), SETTINGS_SSH_KEYS, &f)
+			c.RenderWithErr(c.Tr("settings.ssh_key_been_used"), SettingsSSHKeysTPL, &f)
 		case models.IsErrKeyNameAlreadyUsed(err):
 			c.FormErr("Title")
-			c.RenderWithErr(c.Tr("settings.ssh_key_name_used"), SETTINGS_SSH_KEYS, &f)
+			c.RenderWithErr(c.Tr("settings.ssh_key_name_used"), SettingsSSHKeysTPL, &f)
 		default:
 			c.ServerError("AddPublicKey", err)
 		}
@@ -461,7 +490,7 @@ func SettingsSecurity(c *context.Context) {
 	}
 	c.Data["TwoFactor"] = t
 
-	c.Success(SETTINGS_SECURITY)
+	c.Success(SettingsSecurityTPL)
 }
 
 func SettingsTwoFactorEnable(c *context.Context) {
@@ -506,7 +535,7 @@ func SettingsTwoFactorEnable(c *context.Context) {
 
 	c.Session.Set("twoFactorSecret", c.Data["TwoFactorSecret"])
 	c.Session.Set("twoFactorURL", key.String())
-	c.Success(SETTINGS_TWO_FACTOR_ENABLE)
+	c.Success(SettingsTwoFactorEnableTPL)
 }
 
 func SettingsTwoFactorEnablePost(c *context.Context) {
@@ -550,7 +579,7 @@ func SettingsTwoFactorRecoveryCodes(c *context.Context) {
 	}
 	c.Data["RecoveryCodes"] = recoveryCodes
 
-	c.Success(SETTINGS_TWO_FACTOR_RECOVERY_CODES)
+	c.Success(SettingsTwoFactorRecoveryCodesTPL)
 }
 
 func SettingsTwoFactorRecoveryCodesPost(c *context.Context) {
@@ -600,7 +629,7 @@ func SettingsRepos(c *context.Context) {
 	}
 	c.Data["Repos"] = repos
 
-	c.Success(SETTINGS_REPOSITORIES)
+	c.Success(SettingsRepositoriesTPL)
 }
 
 func SettingsLeaveRepo(c *context.Context) {
@@ -632,7 +661,7 @@ func SettingsOrganizations(c *context.Context) {
 	}
 	c.Data["Orgs"] = orgs
 
-	c.Success(SETTINGS_ORGANIZATIONS)
+	c.Success(SettingsOrganizationsTPL)
 }
 
 func SettingsLeaveOrganization(c *context.Context) {
@@ -661,7 +690,7 @@ func SettingsApplications(c *context.Context) {
 	}
 	c.Data["Tokens"] = tokens
 
-	c.Success(SETTINGS_APPLICATIONS)
+	c.Success(SettingsApplicationsTPL)
 }
 
 func SettingsApplicationsPost(c *context.Context, f form.NewAccessToken) {
@@ -676,7 +705,7 @@ func SettingsApplicationsPost(c *context.Context, f form.NewAccessToken) {
 		}
 
 		c.Data["Tokens"] = tokens
-		c.Success(SETTINGS_APPLICATIONS)
+		c.Success(SettingsApplicationsTPL)
 		return
 	}
 
@@ -710,7 +739,7 @@ func SettingsEmbeds(c *context.Context) {
 	c.Title("settings.embeds")
 	c.PageIs("SettingsEmbeds")
 
-	c.Success(SETTINGS_EMBEDS)
+	c.Success(SettingsEmbedsTPL)
 }
 
 func SettingsDelete(c *context.Context) {
@@ -720,7 +749,7 @@ func SettingsDelete(c *context.Context) {
 	if c.Req.Method == "POST" {
 		if _, err := models.UserLogin(c.User.Name, c.Query("password"), c.User.LoginSource); err != nil {
 			if errors.IsUserNotExist(err) {
-				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SETTINGS_DELETE, nil)
+				c.RenderWithErr(c.Tr("form.enterred_invalid_password"), SettingsDeleteTPL, nil)
 			} else {
 				c.ServerError("UserLogin", err)
 			}
@@ -745,5 +774,5 @@ func SettingsDelete(c *context.Context) {
 		return
 	}
 
-	c.Success(SETTINGS_DELETE)
+	c.Success(SettingsDeleteTPL)
 }