fix: Fix the issue of abnormal login log recording (#9139)

Refs #9054
This commit is contained in:
ssongliu 2025-06-17 16:06:55 +08:00 committed by GitHub
parent 429e2c6cbe
commit 1278e910f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -37,7 +37,7 @@ func (u *AuthService) Login(c *gin.Context, info dto.Login, entrance string) (*d
return nil, "", buserr.New("ErrRecordNotFound")
}
if nameSetting.Value != info.Name {
return nil, "ErrAuth", nil
return nil, "ErrAuth", buserr.New("ErrAuth")
}
if err = checkPassword(info.Password); err != nil {
return nil, "ErrAuth", err
@ -47,7 +47,7 @@ func (u *AuthService) Login(c *gin.Context, info dto.Login, entrance string) (*d
return nil, "", err
}
if len(entranceSetting.Value) != 0 && entranceSetting.Value != entrance {
return nil, "ErrEntrance", nil
return nil, "ErrEntrance", buserr.New("ErrEntrance")
}
mfa, err := settingRepo.Get(repo.WithByKey("MFAStatus"))
if err != nil {

View file

@ -27,7 +27,10 @@
<el-table-column :label="$t('logs.loginAgent')" show-overflow-tooltip prop="agent" />
<el-table-column :label="$t('logs.loginStatus')" prop="status">
<template #default="{ row }">
<Status :status="row.status" :msg="row.message" />
<Status
:status="row.status"
:msg="row.message === 'ErrAuth' ? $t('commons.login.errorAuthInfo') : row.message"
/>
</template>
</el-table-column>
<el-table-column