mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-28 21:41:22 +08:00
Fix various trivial problems (#32861)
1. add/improve comments to help future readers could understand the problem more easily. 2. add an error log to LDAP with username fallback 3. use `or` instead of `Iif` for "repo/branch_dropdown" (`Iif` was a mistake, but it doesn't really affect the UI) 4. add `tw-font-mono` style to container digest to match dockerhub 5. fix a bug in RepoBranchTagSelector: the form is not updated when there is no click to an item --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
||||
"code.gitea.io/gitea/models/auth"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
auth_module "code.gitea.io/gitea/modules/auth"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/optional"
|
||||
asymkey_service "code.gitea.io/gitea/services/asymkey"
|
||||
source_service "code.gitea.io/gitea/services/auth/source"
|
||||
@ -31,7 +32,12 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
|
||||
return nil, user_model.ErrUserNotExist{Name: loginName}
|
||||
}
|
||||
// Fallback.
|
||||
// FIXME: this fallback would cause problems when the "Username" attribute is not set and a user inputs their email.
|
||||
// In this case, the email would be used as the username, and will cause the "CreateUser" failure for the first login.
|
||||
if sr.Username == "" {
|
||||
if strings.Contains(userName, "@") {
|
||||
log.Error("No username in search result (Username Attribute is not set properly?), using email as username might cause problems")
|
||||
}
|
||||
sr.Username = userName
|
||||
}
|
||||
if sr.Mail == "" {
|
||||
|
Reference in New Issue
Block a user