mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Move login related structs and functions to models/login (#17093)
* Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
This commit is contained in:
parent
4a2655098f
commit
5842a55b31
142 changed files with 1050 additions and 907 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/login"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -27,12 +28,12 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
|
|||
return
|
||||
}
|
||||
|
||||
source, err := models.GetLoginSourceByID(sourceID)
|
||||
source, err := login.GetSourceByID(sourceID)
|
||||
if err != nil {
|
||||
if models.IsErrLoginSourceNotExist(err) {
|
||||
if login.IsErrSourceNotExist(err) {
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", err)
|
||||
} else {
|
||||
ctx.Error(http.StatusInternalServerError, "GetLoginSourceByID", err)
|
||||
ctx.Error(http.StatusInternalServerError, "login.GetSourceByID", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -74,7 +75,7 @@ func CreateUser(ctx *context.APIContext) {
|
|||
Passwd: form.Password,
|
||||
MustChangePassword: true,
|
||||
IsActive: true,
|
||||
LoginType: models.LoginPlain,
|
||||
LoginType: login.Plain,
|
||||
}
|
||||
if form.MustChangePassword != nil {
|
||||
u.MustChangePassword = *form.MustChangePassword
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue