mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
support unlinking external authentication
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package core
|
||||
|
||||
const USER_EXTERNAL_AUTH_TYPE_CATEOGRY_OAUTH2 = "oauth2"
|
||||
|
||||
// UserExternalAuthType represents the type of user external authentication
|
||||
type UserExternalAuthType string
|
||||
|
||||
@@ -11,14 +13,19 @@ const (
|
||||
USER_EXTERNAL_AUTH_TYPE_OAUTH2_GITHUB UserExternalAuthType = "github"
|
||||
)
|
||||
|
||||
// IsValid checks if the UserExternalAuthType is valid
|
||||
func (t UserExternalAuthType) IsValid() bool {
|
||||
// GetCategory returns the category of the UserExternalAuthType
|
||||
func (t UserExternalAuthType) GetCategory() string {
|
||||
switch t {
|
||||
case USER_EXTERNAL_AUTH_TYPE_OAUTH2_OIDC,
|
||||
USER_EXTERNAL_AUTH_TYPE_OAUTH2_NEXTCLOUD,
|
||||
USER_EXTERNAL_AUTH_TYPE_OAUTH2_GITEA,
|
||||
USER_EXTERNAL_AUTH_TYPE_OAUTH2_GITHUB:
|
||||
return true
|
||||
return USER_EXTERNAL_AUTH_TYPE_CATEOGRY_OAUTH2
|
||||
}
|
||||
return false
|
||||
return ""
|
||||
}
|
||||
|
||||
// IsValid checks if the UserExternalAuthType is valid
|
||||
func (t UserExternalAuthType) IsValid() bool {
|
||||
return t.GetCategory() != ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user