summaryrefslogtreecommitdiffstats
path: root/routers/web/user
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/user')
-rw-r--r--routers/web/user/auth_openid.go13
-rw-r--r--routers/web/user/profile.go6
-rw-r--r--routers/web/user/setting/security.go3
-rw-r--r--routers/web/user/setting/security_openid.go14
4 files changed, 19 insertions, 17 deletions
diff --git a/routers/web/user/auth_openid.go b/routers/web/user/auth_openid.go
index e6ad6fef4c..4724a7b431 100644
--- a/routers/web/user/auth_openid.go
+++ b/routers/web/user/auth_openid.go
@@ -10,6 +10,7 @@ import (
"net/url"
"code.gitea.io/gitea/models"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/auth/openid"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
@@ -302,9 +303,9 @@ func ConnectOpenIDPost(ctx *context.Context) {
}
// add OpenID for the user
- userOID := &models.UserOpenID{UID: u.ID, URI: oid}
- if err = models.AddUserOpenID(userOID); err != nil {
- if models.IsErrOpenIDAlreadyUsed(err) {
+ userOID := &user_model.UserOpenID{UID: u.ID, URI: oid}
+ if err = user_model.AddUserOpenID(userOID); err != nil {
+ if user_model.IsErrOpenIDAlreadyUsed(err) {
ctx.RenderWithErr(ctx.Tr("form.openid_been_used", oid), tplConnectOID, &form)
return
}
@@ -430,9 +431,9 @@ func RegisterOpenIDPost(ctx *context.Context) {
}
// add OpenID for the user
- userOID := &models.UserOpenID{UID: u.ID, URI: oid}
- if err = models.AddUserOpenID(userOID); err != nil {
- if models.IsErrOpenIDAlreadyUsed(err) {
+ userOID := &user_model.UserOpenID{UID: u.ID, URI: oid}
+ if err = user_model.AddUserOpenID(userOID); err != nil {
+ if user_model.IsErrOpenIDAlreadyUsed(err) {
ctx.RenderWithErr(ctx.Tr("form.openid_been_used", oid), tplSignUpOID, &form)
return
}
diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go
index 17c4783c69..72d36761da 100644
--- a/routers/web/user/profile.go
+++ b/routers/web/user/profile.go
@@ -131,7 +131,7 @@ func Profile(ctx *context.Context) {
}
// Show OpenID URIs
- openIDs, err := models.GetUserOpenIDs(ctxUser.ID)
+ openIDs, err := user_model.GetUserOpenIDs(ctxUser.ID)
if err != nil {
ctx.ServerError("GetUserOpenIDs", err)
return
@@ -355,9 +355,9 @@ func Action(ctx *context.Context) {
var err error
switch ctx.Params(":action") {
case "follow":
- err = models.FollowUser(ctx.User.ID, u.ID)
+ err = user_model.FollowUser(ctx.User.ID, u.ID)
case "unfollow":
- err = models.UnfollowUser(ctx.User.ID, u.ID)
+ err = user_model.UnfollowUser(ctx.User.ID, u.ID)
}
if err != nil {
diff --git a/routers/web/user/setting/security.go b/routers/web/user/setting/security.go
index 65e9790d47..f0b1d8232a 100644
--- a/routers/web/user/setting/security.go
+++ b/routers/web/user/setting/security.go
@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/login"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
@@ -107,7 +108,7 @@ func loadSecurityData(ctx *context.Context) {
}
ctx.Data["AccountLinks"] = sources
- openid, err := models.GetUserOpenIDs(ctx.User.ID)
+ openid, err := user_model.GetUserOpenIDs(ctx.User.ID)
if err != nil {
ctx.ServerError("GetUserOpenIDs", err)
return
diff --git a/routers/web/user/setting/security_openid.go b/routers/web/user/setting/security_openid.go
index 8bb932805c..9cdda79b92 100644
--- a/routers/web/user/setting/security_openid.go
+++ b/routers/web/user/setting/security_openid.go
@@ -7,7 +7,7 @@ package setting
import (
"net/http"
- "code.gitea.io/gitea/models"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/auth/openid"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
@@ -45,7 +45,7 @@ func OpenIDPost(ctx *context.Context) {
form.Openid = id
log.Trace("Normalized id: " + id)
- oids, err := models.GetUserOpenIDs(ctx.User.ID)
+ oids, err := user_model.GetUserOpenIDs(ctx.User.ID)
if err != nil {
ctx.ServerError("GetUserOpenIDs", err)
return
@@ -89,9 +89,9 @@ func settingsOpenIDVerify(ctx *context.Context) {
log.Trace("Verified ID: " + id)
- oid := &models.UserOpenID{UID: ctx.User.ID, URI: id}
- if err = models.AddUserOpenID(oid); err != nil {
- if models.IsErrOpenIDAlreadyUsed(err) {
+ oid := &user_model.UserOpenID{UID: ctx.User.ID, URI: id}
+ if err = user_model.AddUserOpenID(oid); err != nil {
+ if user_model.IsErrOpenIDAlreadyUsed(err) {
ctx.RenderWithErr(ctx.Tr("form.openid_been_used", id), tplSettingsSecurity, &forms.AddOpenIDForm{Openid: id})
return
}
@@ -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.FormInt64("id"), UID: ctx.User.ID}); err != nil {
+ if err := user_model.DeleteUserOpenID(&user_model.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.FormInt64("id")); err != nil {
+ if err := user_model.ToggleUserOpenIDVisibility(ctx.FormInt64("id")); err != nil {
ctx.ServerError("ToggleUserOpenIDVisibility", err)
return
}