mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Rename context.Query to context.Form (#16562)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
@@ -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))
|
||||
|
@@ -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"))
|
||||
|
@@ -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")
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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 {
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user