diff options
Diffstat (limited to 'routers/web/user/setting')
-rw-r--r-- | routers/web/user/setting/account.go | 16 | ||||
-rw-r--r-- | routers/web/user/setting/adopt.go | 4 | ||||
-rw-r--r-- | routers/web/user/setting/applications.go | 2 | ||||
-rw-r--r-- | routers/web/user/setting/keys.go | 10 | ||||
-rw-r--r-- | routers/web/user/setting/oauth2.go | 6 | ||||
-rw-r--r-- | routers/web/user/setting/profile.go | 2 | ||||
-rw-r--r-- | routers/web/user/setting/security.go | 4 | ||||
-rw-r--r-- | routers/web/user/setting/security_openid.go | 4 |
8 files changed, 24 insertions, 24 deletions
diff --git a/routers/web/user/setting/account.go b/routers/web/user/setting/account.go index 80b186262e..ea349949f9 100644 --- a/routers/web/user/setting/account.go +++ b/routers/web/user/setting/account.go @@ -90,8 +90,8 @@ func EmailPost(ctx *context.Context) { ctx.Data["PageIsSettingsAccount"] = true // Make emailaddress primary. - if ctx.Query("_method") == "PRIMARY" { - if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil { + if ctx.Form("_method") == "PRIMARY" { + if err := models.MakeEmailPrimary(&models.EmailAddress{ID: ctx.FormInt64("id")}); err != nil { ctx.ServerError("MakeEmailPrimary", err) return } @@ -101,7 +101,7 @@ func EmailPost(ctx *context.Context) { return } // Send activation Email - if ctx.Query("_method") == "SENDACTIVATION" { + if ctx.Form("_method") == "SENDACTIVATION" { var address string if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) { log.Error("Send activation: activation still pending") @@ -109,7 +109,7 @@ func EmailPost(ctx *context.Context) { return } - id := ctx.QueryInt64("id") + id := ctx.FormInt64("id") email, err := models.GetEmailAddressByID(ctx.User.ID, id) if err != nil { log.Error("GetEmailAddressByID(%d,%d) error: %v", ctx.User.ID, id, err) @@ -147,8 +147,8 @@ func EmailPost(ctx *context.Context) { return } // Set Email Notification Preference - if ctx.Query("_method") == "NOTIFICATION" { - preference := ctx.Query("preference") + if ctx.Form("_method") == "NOTIFICATION" { + preference := ctx.Form("preference") if !(preference == models.EmailNotificationsEnabled || preference == models.EmailNotificationsOnMention || preference == models.EmailNotificationsDisabled) { @@ -212,7 +212,7 @@ func EmailPost(ctx *context.Context) { // DeleteEmail response for delete user's email func DeleteEmail(ctx *context.Context) { - if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id"), UID: ctx.User.ID}); err != nil { + if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.FormInt64("id"), UID: ctx.User.ID}); err != nil { ctx.ServerError("DeleteEmail", err) return } @@ -229,7 +229,7 @@ func DeleteAccount(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsAccount"] = true - if _, err := auth.UserSignIn(ctx.User.Name, ctx.Query("password")); err != nil { + if _, err := auth.UserSignIn(ctx.User.Name, ctx.Form("password")); err != nil { if models.IsErrUserNotExist(err) { loadAccountData(ctx) diff --git a/routers/web/user/setting/adopt.go b/routers/web/user/setting/adopt.go index b2d918784f..8ade9c4257 100644 --- a/routers/web/user/setting/adopt.go +++ b/routers/web/user/setting/adopt.go @@ -23,8 +23,8 @@ func AdoptOrDeleteRepository(ctx *context.Context) { allowDelete := ctx.IsUserSiteAdmin() || setting.Repository.AllowDeleteOfUnadoptedRepositories ctx.Data["allowDelete"] = allowDelete - dir := ctx.Query("id") - action := ctx.Query("action") + dir := ctx.Form("id") + action := ctx.Form("action") ctxUser := ctx.User root := filepath.Join(models.UserPath(ctxUser.LowerName)) diff --git a/routers/web/user/setting/applications.go b/routers/web/user/setting/applications.go index 4161efdea4..5e208afafe 100644 --- a/routers/web/user/setting/applications.go +++ b/routers/web/user/setting/applications.go @@ -72,7 +72,7 @@ func ApplicationsPost(ctx *context.Context) { // DeleteApplication response for delete user access token func DeleteApplication(ctx *context.Context) { - if err := models.DeleteAccessTokenByID(ctx.QueryInt64("id"), ctx.User.ID); err != nil { + if err := models.DeleteAccessTokenByID(ctx.FormInt64("id"), ctx.User.ID); err != nil { ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("settings.delete_token_success")) diff --git a/routers/web/user/setting/keys.go b/routers/web/user/setting/keys.go index d875d84a76..c1ea87cabc 100644 --- a/routers/web/user/setting/keys.go +++ b/routers/web/user/setting/keys.go @@ -193,15 +193,15 @@ func KeysPost(ctx *context.Context) { // DeleteKey response for delete user's SSH/GPG key func DeleteKey(ctx *context.Context) { - switch ctx.Query("type") { + switch ctx.Form("type") { case "gpg": - if err := models.DeleteGPGKey(ctx.User, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteGPGKey(ctx.User, ctx.FormInt64("id")); err != nil { ctx.Flash.Error("DeleteGPGKey: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("settings.gpg_key_deletion_success")) } case "ssh": - keyID := ctx.QueryInt64("id") + keyID := ctx.FormInt64("id") external, err := models.PublicKeyIsExternallyManaged(keyID) if err != nil { ctx.ServerError("sshKeysExternalManaged", err) @@ -218,7 +218,7 @@ func DeleteKey(ctx *context.Context) { ctx.Flash.Success(ctx.Tr("settings.ssh_key_deletion_success")) } case "principal": - if err := models.DeletePublicKey(ctx.User, ctx.QueryInt64("id")); err != nil { + if err := models.DeletePublicKey(ctx.User, ctx.FormInt64("id")); err != nil { ctx.Flash.Error("DeletePublicKey: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("settings.ssh_principal_deletion_success")) @@ -265,5 +265,5 @@ func loadKeysData(ctx *context.Context) { } ctx.Data["Principals"] = principals - ctx.Data["VerifyingID"] = ctx.Query("verify_gpg") + ctx.Data["VerifyingID"] = ctx.Form("verify_gpg") } diff --git a/routers/web/user/setting/oauth2.go b/routers/web/user/setting/oauth2.go index c8db6e87f2..8de0720b51 100644 --- a/routers/web/user/setting/oauth2.go +++ b/routers/web/user/setting/oauth2.go @@ -129,7 +129,7 @@ func OAuth2ApplicationShow(ctx *context.Context) { // DeleteOAuth2Application deletes the given oauth2 application func DeleteOAuth2Application(ctx *context.Context) { - if err := models.DeleteOAuth2Application(ctx.QueryInt64("id"), ctx.User.ID); err != nil { + if err := models.DeleteOAuth2Application(ctx.FormInt64("id"), ctx.User.ID); err != nil { ctx.ServerError("DeleteOAuth2Application", err) return } @@ -143,11 +143,11 @@ func DeleteOAuth2Application(ctx *context.Context) { // RevokeOAuth2Grant revokes the grant with the given id func RevokeOAuth2Grant(ctx *context.Context) { - if ctx.User.ID == 0 || ctx.QueryInt64("id") == 0 { + if ctx.User.ID == 0 || ctx.FormInt64("id") == 0 { ctx.ServerError("RevokeOAuth2Grant", fmt.Errorf("user id or grant id is zero")) return } - if err := models.RevokeOAuth2Grant(ctx.QueryInt64("id"), ctx.User.ID); err != nil { + if err := models.RevokeOAuth2Grant(ctx.FormInt64("id"), ctx.User.ID); err != nil { ctx.ServerError("RevokeOAuth2Grant", err) return } diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index bec523509c..15c08856b4 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -237,7 +237,7 @@ func Repos(ctx *context.Context) { opts := models.ListOptions{ PageSize: setting.UI.Admin.UserPagingNum, - Page: ctx.QueryInt("page"), + Page: ctx.FormInt("page"), } if opts.Page <= 0 { diff --git a/routers/web/user/setting/security.go b/routers/web/user/setting/security.go index dd5d2a20cc..02969fb1e6 100644 --- a/routers/web/user/setting/security.go +++ b/routers/web/user/setting/security.go @@ -26,7 +26,7 @@ func Security(ctx *context.Context) { ctx.Data["PageIsSettingsSecurity"] = true ctx.Data["RequireU2F"] = true - if ctx.Query("openid.return_to") != "" { + if ctx.Form("openid.return_to") != "" { settingsOpenIDVerify(ctx) return } @@ -38,7 +38,7 @@ func Security(ctx *context.Context) { // DeleteAccountLink delete a single account link func DeleteAccountLink(ctx *context.Context) { - id := ctx.QueryInt64("id") + id := ctx.FormInt64("id") if id <= 0 { ctx.Flash.Error("Account link id is not given") } else { diff --git a/routers/web/user/setting/security_openid.go b/routers/web/user/setting/security_openid.go index 74dba12825..8bb932805c 100644 --- a/routers/web/user/setting/security_openid.go +++ b/routers/web/user/setting/security_openid.go @@ -106,7 +106,7 @@ func settingsOpenIDVerify(ctx *context.Context) { // DeleteOpenID response for delete user's openid func DeleteOpenID(ctx *context.Context) { - if err := models.DeleteUserOpenID(&models.UserOpenID{ID: ctx.QueryInt64("id"), UID: ctx.User.ID}); err != nil { + if err := models.DeleteUserOpenID(&models.UserOpenID{ID: ctx.FormInt64("id"), UID: ctx.User.ID}); err != nil { ctx.ServerError("DeleteUserOpenID", err) return } @@ -120,7 +120,7 @@ func DeleteOpenID(ctx *context.Context) { // ToggleOpenIDVisibility response for toggle visibility of user's openid func ToggleOpenIDVisibility(ctx *context.Context) { - if err := models.ToggleUserOpenIDVisibility(ctx.QueryInt64("id")); err != nil { + if err := models.ToggleUserOpenIDVisibility(ctx.FormInt64("id")); err != nil { ctx.ServerError("ToggleUserOpenIDVisibility", err) return } |