Move login related structs and functions to models/login #17093

Merged
lunny merged 19 commits from lunny/models_login into main 2021-09-24 11:32:57 +00:00
Owner

This PR create a sub package of models named models/login. And moved LoginSource and OAuth2 related models files there.
As the package name changed, LoginSource has been renamed as Source and also other related types and functions to make lint happy.

And now, since models/login's unit tests only needs parts of fixtures, db.MainTest now supports special fixture files.

This PR create a sub package of `models` named `models/login`. And moved `LoginSource` and `OAuth2` related models files there. As the package name changed, `LoginSource` has been renamed as `Source` and also other related types and functions to make lint happy. And now, since `models/login`'s unit tests only needs parts of fixtures, `db.MainTest` now supports special fixture files.
axifive (Migrated from github.com) requested changes 2021-09-22 21:54:25 +00:00
axifive (Migrated from github.com) left a comment
Author
Owner

58ef57cf4b/models/login/source.go (L250)
"CreateLoginSource" => "CreateSource"

https://github.com/go-gitea/gitea/blob/58ef57cf4b39eaf302e74885a85cfc92cfa3fed4/models/login/source.go#L250 `"CreateLoginSource" => "CreateSource"`
@ -0,0 +288,4 @@
// IsSSPIEnabled returns true if there is at least one activated login
// source of type LoginSSPI
func IsSSPIEnabled() bool {
axifive (Migrated from github.com) commented 2021-09-22 21:23:06 +00:00
Author
Owner
		log.Error("ActiveSources: %v", err)
```suggestion log.Error("ActiveSources: %v", err) ```
axifive (Migrated from github.com) commented 2021-09-22 21:40:18 +00:00
Author
Owner
			ctx.Error(http.StatusInternalServerError, "login.GetSourceByID", err)
```suggestion ctx.Error(http.StatusInternalServerError, "login.GetSourceByID", err) ```
axifive (Migrated from github.com) commented 2021-09-22 21:03:40 +00:00
Author
Owner
			ctx.ServerError("login.CreateSource", err)
```suggestion ctx.ServerError("login.CreateSource", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:45:05 +00:00
Author
Owner
		ctx.ServerError("login.GetSourceByID", err)
```suggestion ctx.ServerError("login.GetSourceByID", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:45:23 +00:00
Author
Owner
		ctx.ServerError("login.GetSourceByID", err)
```suggestion ctx.ServerError("login.GetSourceByID", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:28:35 +00:00
Author
Owner
		ctx.ServerError("login.GetSourceByID", err)
```suggestion ctx.ServerError("login.GetSourceByID", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:47:11 +00:00
Author
Owner
			ctx.Flash.Error(fmt.Sprintf("DeleteLoginSource: %v", err))
```suggestion ctx.Flash.Error(fmt.Sprintf("DeleteLoginSource: %v", err)) ```
axifive (Migrated from github.com) commented 2021-09-22 20:41:00 +00:00
Author
Owner
		ctx.ServerError("login.Sources", err)
```suggestion ctx.ServerError("login.Sources", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:41:17 +00:00
Author
Owner
		ctx.ServerError("login.Sources", err)
```suggestion ctx.ServerError("login.Sources", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:41:44 +00:00
Author
Owner
			ctx.ServerError("login.GetSourceByID", err)
```suggestion ctx.ServerError("login.GetSourceByID", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:42:01 +00:00
Author
Owner
		ctx.ServerError("login.Sources", err)
```suggestion ctx.ServerError("login.Sources", err) ```
axifive (Migrated from github.com) commented 2021-09-22 20:21:02 +00:00
Author
Owner
		ctx.ServerError("GetUserByID", err)
```suggestion ctx.ServerError("GetUserByID", err) ```
axifive (Migrated from github.com) approved these changes 2021-09-23 08:18:33 +00:00
axifive (Migrated from github.com) reviewed 2021-09-23 14:21:31 +00:00
axifive (Migrated from github.com) commented 2021-09-23 14:21:31 +00:00
Author
Owner

found one more

		ctx.ServerError("login.Sources", err)
found one more ```suggestion ctx.ServerError("login.Sources", err) ```
lunny reviewed 2021-09-23 15:44:58 +00:00
wxiaoguang approved these changes 2021-09-24 10:47:03 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#17093
No description provided.