fix creating login records for user failed (#2572)

Signed-off-by: Jeff <zw0948@gmail.com>

Co-authored-by: hongming <talonwan@yunify.com>
This commit is contained in:
zryfish
2020-07-23 23:36:11 +08:00
committed by GitHub
parent 3d74bb0589
commit 06932926a0
3 changed files with 8 additions and 8 deletions

View File

@@ -77,7 +77,7 @@ func (im *passwordAuthenticator) Authenticate(username, password string) (authus
// no identity provider
// even auth failed, still return username to record login attempt
if user == nil && (providerOptions == nil || providerOptions.MappingMethod != oauth.MappingMethodAuto) {
return &authuser.DefaultInfo{Name: user.Name}, AuthFailedIncorrectPassword
return nil, AuthFailedIncorrectPassword
}
if user != nil && user.Status.State != iamv1alpha2.UserActive {

View File

@@ -43,7 +43,6 @@ func NewLoginRecorder(ksClient kubesphere.Interface) LoginRecorder {
}
func (l *loginRecorder) RecordLogin(username string, authErr error, req *http.Request) error {
loginEntry := &iamv1alpha2.LoginRecord{
ObjectMeta: metav1.ObjectMeta{
GenerateName: fmt.Sprintf("%s-", username),