VirtoCommerce / vc-storefront

Virto Commerce Storefront - ASP.NET Core 8.0
http://virtocommerce.com
Other
210 stars 211 forks source link

PT-13083: Refactored and improved error codes for the locked user #652

Closed OlegoO closed 1 year ago

OlegoO commented 1 year ago

Description:

feat: Refactored and improved error codes for the locked user on account/login.

Code Condition Default Message
username_or_emailIs_required login.UserName == null && login.Email == null Please provide a username or email
login_failed user == null Login attempt failed. Please check your credentials.
email_verification_is_required loginResult.IsLockedOut && user.Status == "Locked" && !user.EmailConfirmed; Email verification required. Please verify your email address.
user_is_temporary_locked_out loginResult.IsLockedOut && user.LockoutEndDateUtc != DateTime.MaxValue.ToUniversalTime() Your account has been temporarily locked. Please try again after some time.
user_is_locked_out loginResult.IsLockedOut Your account has been locked. Please contact support for assistance.
login_failed !loginResult.Succeeded Login attempt failed. Please check your credentials.
user_cannot_login_in_store NOT            var result = _user.IsAdministrator || _user.StoreId.IsNullOrEmpty();             if (!result)             {                 result = obj.TrustedGroups.Concat(new[] { obj.Id }).Contains(_user.StoreId);             }             return result; Access denied. You cannot sign in to the current store
password_expired user.PasswordExpired Your password has been expired and must be changed.

--

QA-test:

Demo-test:

Download artifact URL:

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

1.2% 1.2% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. Read more here