summaryrefslogtreecommitdiffstats
path: root/routers/web/user/setting/applications.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/user/setting/applications.go')
-rw-r--r--routers/web/user/setting/applications.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/routers/web/user/setting/applications.go b/routers/web/user/setting/applications.go
index 4ffec47801..e9572a07a6 100644
--- a/routers/web/user/setting/applications.go
+++ b/routers/web/user/setting/applications.go
@@ -8,8 +8,7 @@ package setting
import (
"net/http"
- "code.gitea.io/gitea/models"
- "code.gitea.io/gitea/models/auth"
+ auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
@@ -44,12 +43,12 @@ func ApplicationsPost(ctx *context.Context) {
return
}
- t := &models.AccessToken{
+ t := &auth_model.AccessToken{
UID: ctx.Doer.ID,
Name: form.Name,
}
- exist, err := models.AccessTokenByNameExists(t)
+ exist, err := auth_model.AccessTokenByNameExists(t)
if err != nil {
ctx.ServerError("AccessTokenByNameExists", err)
return
@@ -60,7 +59,7 @@ func ApplicationsPost(ctx *context.Context) {
return
}
- if err := models.NewAccessToken(t); err != nil {
+ if err := auth_model.NewAccessToken(t); err != nil {
ctx.ServerError("NewAccessToken", err)
return
}
@@ -73,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.FormInt64("id"), ctx.Doer.ID); err != nil {
+ if err := auth_model.DeleteAccessTokenByID(ctx.FormInt64("id"), ctx.Doer.ID); err != nil {
ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("settings.delete_token_success"))
@@ -85,7 +84,7 @@ func DeleteApplication(ctx *context.Context) {
}
func loadApplicationsData(ctx *context.Context) {
- tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{UserID: ctx.Doer.ID})
+ tokens, err := auth_model.ListAccessTokens(auth_model.ListAccessTokensOptions{UserID: ctx.Doer.ID})
if err != nil {
ctx.ServerError("ListAccessTokens", err)
return
@@ -93,12 +92,12 @@ func loadApplicationsData(ctx *context.Context) {
ctx.Data["Tokens"] = tokens
ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
if setting.OAuth2.Enable {
- ctx.Data["Applications"], err = auth.GetOAuth2ApplicationsByUserID(ctx, ctx.Doer.ID)
+ ctx.Data["Applications"], err = auth_model.GetOAuth2ApplicationsByUserID(ctx, ctx.Doer.ID)
if err != nil {
ctx.ServerError("GetOAuth2ApplicationsByUserID", err)
return
}
- ctx.Data["Grants"], err = auth.GetOAuth2GrantsByUserID(ctx, ctx.Doer.ID)
+ ctx.Data["Grants"], err = auth_model.GetOAuth2GrantsByUserID(ctx, ctx.Doer.ID)
if err != nil {
ctx.ServerError("GetOAuth2GrantsByUserID", err)
return