diff options
author | Unknwon <u@gogs.io> | 2018-04-12 09:55:58 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-04-12 09:55:58 -0400 |
commit | f2ecfdc96a338815ffb2be898b3114031f0da48c (patch) | |
tree | 68e98cdb346e8d57e7d1b25169b391dd7afc0037 /models/errors/login_source.go | |
parent | 717d409b7273f7874c38268e1b908596277dacac (diff) |
auth: support authentication source config file (#3142)
Diffstat (limited to 'models/errors/login_source.go')
-rw-r--r-- | models/errors/login_source.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/models/errors/login_source.go b/models/errors/login_source.go index db0cd1f9..dd18664e 100644 --- a/models/errors/login_source.go +++ b/models/errors/login_source.go @@ -6,6 +6,19 @@ package errors import "fmt" +type LoginSourceNotExist struct { + ID int64 +} + +func IsLoginSourceNotExist(err error) bool { + _, ok := err.(LoginSourceNotExist) + return ok +} + +func (err LoginSourceNotExist) Error() string { + return fmt.Sprintf("login source does not exist [id: %d]", err.ID) +} + type LoginSourceNotActivated struct { SourceID int64 } @@ -31,3 +44,17 @@ func IsInvalidLoginSourceType(err error) bool { func (err InvalidLoginSourceType) Error() string { return fmt.Sprintf("invalid login source type [type: %v]", err.Type) } + +type LoginSourceMismatch struct { + Expect int64 + Actual int64 +} + +func IsLoginSourceMismatch(err error) bool { + _, ok := err.(LoginSourceMismatch) + return ok +} + +func (err LoginSourceMismatch) Error() string { + return fmt.Sprintf("login source mismatch [expect: %d, actual: %d]", err.Expect, err.Actual) +} |