satellite/{web, console}: removed account locked statuses
Removed all the account locked messages. Removed toast notification for login screen. Updated wrong login credentials message. Issues: https://github.com/storj/storj/issues/4910 https://github.com/storj/storj/issues/4953 Change-Id: I1ac0ce16d3c1317204c28a509c21ebf3686a145e
This commit is contained in:
parent
30727b9036
commit
d76acda27e
@ -783,7 +783,7 @@ func (a *Auth) getStatusCode(err error) int {
|
|||||||
switch {
|
switch {
|
||||||
case console.ErrValidation.Has(err), console.ErrCaptcha.Has(err), console.ErrMFAMissing.Has(err):
|
case console.ErrValidation.Has(err), console.ErrCaptcha.Has(err), console.ErrMFAMissing.Has(err):
|
||||||
return http.StatusBadRequest
|
return http.StatusBadRequest
|
||||||
case console.ErrUnauthorized.Has(err), console.ErrRecoveryToken.Has(err), console.ErrLoginCredentials.Has(err), console.ErrLoginPassword.Has(err), console.ErrLockedAccount.Has(err):
|
case console.ErrUnauthorized.Has(err), console.ErrRecoveryToken.Has(err), console.ErrLoginCredentials.Has(err), console.ErrLoginPassword.Has(err):
|
||||||
return http.StatusUnauthorized
|
return http.StatusUnauthorized
|
||||||
case console.ErrEmailUsed.Has(err), console.ErrMFAConflict.Has(err):
|
case console.ErrEmailUsed.Has(err), console.ErrMFAConflict.Has(err):
|
||||||
return http.StatusConflict
|
return http.StatusConflict
|
||||||
@ -822,8 +822,6 @@ func (a *Auth) getUserErrorMessage(err error) string {
|
|||||||
return "Your login credentials are incorrect, please try again"
|
return "Your login credentials are incorrect, please try again"
|
||||||
case console.ErrLoginPassword.Has(err):
|
case console.ErrLoginPassword.Has(err):
|
||||||
return "Your login credentials are incorrect. You have just used up one of your login attempts"
|
return "Your login credentials are incorrect. You have just used up one of your login attempts"
|
||||||
case console.ErrLockedAccount.Has(err):
|
|
||||||
return err.Error()
|
|
||||||
case console.ErrValidation.Has(err):
|
case console.ErrValidation.Has(err):
|
||||||
return err.Error()
|
return err.Error()
|
||||||
case errors.Is(err, errNotImplemented):
|
case errors.Is(err, errNotImplemented):
|
||||||
|
@ -55,8 +55,6 @@ const (
|
|||||||
emailNotFoundErrMsg = "There are no users with the specified email"
|
emailNotFoundErrMsg = "There are no users with the specified email"
|
||||||
passwordRecoveryTokenIsExpiredErrMsg = "Your password recovery link has expired, please request another one"
|
passwordRecoveryTokenIsExpiredErrMsg = "Your password recovery link has expired, please request another one"
|
||||||
credentialsErrMsg = "Your login credentials are incorrect, please try again"
|
credentialsErrMsg = "Your login credentials are incorrect, please try again"
|
||||||
lockedAccountErrMsg = "Your account is locked, please try again later"
|
|
||||||
lockedAccountWithResultErrMsg = "Your login credentials are incorrect, your account is locked again"
|
|
||||||
passwordIncorrectErrMsg = "Your password needs at least %d characters long"
|
passwordIncorrectErrMsg = "Your password needs at least %d characters long"
|
||||||
projectOwnerDeletionForbiddenErrMsg = "%s is a project owner and can not be deleted"
|
projectOwnerDeletionForbiddenErrMsg = "%s is a project owner and can not be deleted"
|
||||||
apiKeyWithNameExistsErrMsg = "An API Key with this name already exists in this project, please use a different name"
|
apiKeyWithNameExistsErrMsg = "An API Key with this name already exists in this project, please use a different name"
|
||||||
@ -96,9 +94,6 @@ var (
|
|||||||
// ErrLoginPassword occurs when provided invalid login password.
|
// ErrLoginPassword occurs when provided invalid login password.
|
||||||
ErrLoginPassword = errs.Class("login password")
|
ErrLoginPassword = errs.Class("login password")
|
||||||
|
|
||||||
// ErrLockedAccount occurs when user's account is locked.
|
|
||||||
ErrLockedAccount = errs.Class("locked")
|
|
||||||
|
|
||||||
// ErrEmailUsed is error type that occurs on repeating auth attempts with email.
|
// ErrEmailUsed is error type that occurs on repeating auth attempts with email.
|
||||||
ErrEmailUsed = errs.Class("email used")
|
ErrEmailUsed = errs.Class("email used")
|
||||||
|
|
||||||
@ -998,7 +993,7 @@ func (s *Service) Token(ctx context.Context, request AuthUser) (token consoleaut
|
|||||||
|
|
||||||
if user.LoginLockoutExpiration.After(now) {
|
if user.LoginLockoutExpiration.After(now) {
|
||||||
mon.Counter("login_locked_out").Inc(1) //mon:locked
|
mon.Counter("login_locked_out").Inc(1) //mon:locked
|
||||||
return consoleauth.Token{}, ErrLockedAccount.New(lockedAccountErrMsg)
|
return consoleauth.Token{}, ErrLoginCredentials.New(credentialsErrMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLockAccount := func() error {
|
handleLockAccount := func() error {
|
||||||
@ -1012,12 +1007,10 @@ func (s *Service) Token(ctx context.Context, request AuthUser) (token consoleaut
|
|||||||
|
|
||||||
if user.FailedLoginCount == s.config.LoginAttemptsWithoutPenalty {
|
if user.FailedLoginCount == s.config.LoginAttemptsWithoutPenalty {
|
||||||
mon.Counter("login_lockout_initiated").Inc(1) //mon:locked
|
mon.Counter("login_lockout_initiated").Inc(1) //mon:locked
|
||||||
return ErrLockedAccount.New(lockedAccountErrMsg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.FailedLoginCount > s.config.LoginAttemptsWithoutPenalty {
|
if user.FailedLoginCount > s.config.LoginAttemptsWithoutPenalty {
|
||||||
mon.Counter("login_lockout_reinitiated").Inc(1) //mon:locked
|
mon.Counter("login_lockout_reinitiated").Inc(1) //mon:locked
|
||||||
return ErrLockedAccount.New(lockedAccountWithResultErrMsg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -824,11 +824,7 @@ func TestLockAccount(t *testing.T) {
|
|||||||
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
||||||
token, err = service.Token(ctx, authUser)
|
token, err = service.Token(ctx, authUser)
|
||||||
require.Empty(t, token)
|
require.Empty(t, token)
|
||||||
if i < consoleConfig.LoginAttemptsWithoutPenalty {
|
require.True(t, console.ErrLoginPassword.Has(err))
|
||||||
require.True(t, console.ErrLoginPassword.Has(err))
|
|
||||||
} else {
|
|
||||||
require.True(t, console.ErrLockedAccount.Has(err))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lockedUser, err := service.GetUser(userCtx, user.ID)
|
lockedUser, err := service.GetUser(userCtx, user.ID)
|
||||||
@ -869,11 +865,7 @@ func TestLockAccount(t *testing.T) {
|
|||||||
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
||||||
token, err = service.Token(ctx, authUser)
|
token, err = service.Token(ctx, authUser)
|
||||||
require.Empty(t, token)
|
require.Empty(t, token)
|
||||||
if i < consoleConfig.LoginAttemptsWithoutPenalty {
|
require.True(t, console.ErrMFAPasscode.Has(err))
|
||||||
require.True(t, console.ErrMFAPasscode.Has(err))
|
|
||||||
} else {
|
|
||||||
require.True(t, console.ErrLockedAccount.Has(err))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lockedUser, err = service.GetUser(userCtx, user.ID)
|
lockedUser, err = service.GetUser(userCtx, user.ID)
|
||||||
@ -897,11 +889,7 @@ func TestLockAccount(t *testing.T) {
|
|||||||
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
for i := 1; i <= consoleConfig.LoginAttemptsWithoutPenalty; i++ {
|
||||||
token, err = service.Token(ctx, authUser)
|
token, err = service.Token(ctx, authUser)
|
||||||
require.Empty(t, token)
|
require.Empty(t, token)
|
||||||
if i < consoleConfig.LoginAttemptsWithoutPenalty {
|
require.True(t, console.ErrMFARecoveryCode.Has(err))
|
||||||
require.True(t, console.ErrMFARecoveryCode.Has(err))
|
|
||||||
} else {
|
|
||||||
require.True(t, console.ErrLockedAccount.Has(err))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lockedUser, err = service.GetUser(userCtx, user.ID)
|
lockedUser, err = service.GetUser(userCtx, user.ID)
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
<h2 class="info-box__header__label">Invalid Credentials</h2>
|
<h2 class="info-box__header__label">Invalid Credentials</h2>
|
||||||
</div>
|
</div>
|
||||||
<p class="info-box__message">
|
<p class="info-box__message">
|
||||||
Your login credentials are incorrect. If you didn’t receive an activation email, click <router-link :to="activatePath" class="link">here</router-link>.
|
Login failed. Please check if this is the correct satellite for your account. If you are
|
||||||
|
sure your credentials are correct, please check your email inbox for a notification with
|
||||||
|
further instructions.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="login-area__input-wrapper">
|
<div class="login-area__input-wrapper">
|
||||||
@ -250,7 +252,7 @@ export default class Login extends Vue {
|
|||||||
*/
|
*/
|
||||||
public onLogoClick(): void {
|
public onLogoClick(): void {
|
||||||
const homepageURL = MetaUtils.getMetaContent('homepage-url');
|
const homepageURL = MetaUtils.getMetaContent('homepage-url');
|
||||||
window.location.href = homepageURL;
|
if (homepageURL) window.location.href = homepageURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,7 +409,6 @@ export default class Login extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error instanceof ErrorUnauthorized) {
|
if (error instanceof ErrorUnauthorized) {
|
||||||
await this.$notify.error(error.message);
|
|
||||||
this.isBadLoginMessageShown = true;
|
this.isBadLoginMessageShown = true;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user