Skip to content

feat: ldap#448

Merged
zxh326 merged 1 commit intomainfrom
feat/ldap
Mar 25, 2026
Merged

feat: ldap#448
zxh326 merged 1 commit intomainfrom
feat/ldap

Conversation

@zxh326
Copy link
Collaborator

@zxh326 zxh326 commented Mar 25, 2026

fix: #431, #417

Signed-off-by: Zzde <zhangxh1997@gmail.com>
@zxh326
Copy link
Collaborator Author

zxh326 commented Mar 25, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9228951afc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +113
errMsg := fmt.Sprintf("%s login failed for %s: %v", strings.ToUpper(provider), username, err)
klog.Warning(errMsg)
if isCredentialFailure(err) {
c.JSON(http.StatusUnauthorized, gin.H{"error": errMsg})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep credential login errors generic for clients

The response now echoes provider, username, and the raw backend error string to the client on both auth failures and server failures. This leaks internal details (for example DB/LDAP error text) and exposes attempted usernames, and it also breaks the frontend's login.errors.invalidCredentials mapping because the error key is no longer stable. Keep the detailed string in logs, but return a fixed client-safe message.

Useful? React with 👍 / 👎.

Comment on lines +177 to +178
if err := DB.Create(&setting).Error; err != nil {
return nil, err

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle duplicate insert in LDAP setting bootstrap

When the LDAP settings row does not exist, concurrent first-time requests can both pass First(&setting, 1) and race on Create(&setting). The loser gets a duplicate-key error and this path returns it directly, causing transient failures (e.g., /admin/ldap-setting returning 500). After a duplicate-key on create, this should re-read the row instead of failing.

Useful? React with 👍 / 👎.

@zxh326 zxh326 merged commit 9aa6f67 into main Mar 25, 2026
3 checks passed
@zxh326 zxh326 deleted the feat/ldap branch March 25, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hopefully one day it will support LDAP integration!

1 participant