mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-13 14:27:17 +00:00
fix: do 2FA on OpenID connect
This commit is contained in:
parent
9828aca733
commit
90e974cd24
6 changed files with 79 additions and 16 deletions
|
@ -40,8 +40,8 @@ func GetUserOpenIDs(ctx context.Context, uid int64) ([]*UserOpenID, error) {
|
|||
return openids, nil
|
||||
}
|
||||
|
||||
// isOpenIDUsed returns true if the openid has been used.
|
||||
func isOpenIDUsed(ctx context.Context, uri string) (bool, error) {
|
||||
// IsOpenIDUsed returns true if the openid has been used.
|
||||
func IsOpenIDUsed(ctx context.Context, uri string) (bool, error) {
|
||||
if len(uri) == 0 {
|
||||
return true, nil
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func (err ErrOpenIDAlreadyUsed) Unwrap() error {
|
|||
// AddUserOpenID adds an pre-verified/normalized OpenID URI to given user.
|
||||
// NOTE: make sure openid.URI is normalized already
|
||||
func AddUserOpenID(ctx context.Context, openid *UserOpenID) error {
|
||||
used, err := isOpenIDUsed(ctx, openid.URI)
|
||||
used, err := IsOpenIDUsed(ctx, openid.URI)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if used {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue