Skip to content

Commit

Permalink
ensuring that the password reset screen displays an appropriate messa…
Browse files Browse the repository at this point in the history
…ge if password policy fails
  • Loading branch information
Bo Motlagh committed Oct 4, 2023
1 parent 27298b1 commit 58753c7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ue-auth",
"altName": "UE-Auth",
"version": "1.36.0",
"version": "1.36.1",
"description": "UE Auth is a multi-tenant OIDC Provider, User Management, B2B Product Access, and Roles/Permissions Management system intended to create a single hybrid solution to serve as Identity and Access for both self-registered B2C Apps and Enterprise B2B Solutions",
"private": false,
"license": "SEE LICENSE IN ./LICENSE.md",
Expand Down
2 changes: 1 addition & 1 deletion src/api/accounts/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
if(!policy.test(password)) {
const message = (custom) ? 'Password must follow the policy. Contact your administrator' :
`Password must follow the policy: At least ${p.pattern.characters} characters${(p.pattern.caps) ? ', at least one capital' : ''}${(p.pattern.number) ? ', at least one number' : ''}${(p.pattern.special) ? ', at least one special character' : ''}.`;
throw Boom.badRequest(message);
throw Boom.expectationFailed(message);
}
}
},
Expand Down
26 changes: 23 additions & 3 deletions views/forgotpassword/forgotSend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ window.addEventListener( 'load', function () {
if (event.target.status !== 204) {
document.getElementById('message').classList.add('error');
document.getElementById('title').innerHTML = 'Uh oh...';
document.getElementById('message').innerHTML = 'Verification or reset was not successful. Your reset or verification window may have expired. Click below to resend the email';
let innerHtml = 'Verification or reset was not successful. Your reset or verification window may have expired. Click below to resend the email';
if(event.target.status === 417) {
let responseMessage;
try {
responseMessage = JSON.parse(event.target.response);
innerHtml = `Password reset was not successful. ${responseMessage?.message}`;
} catch(e) {
innerHtml = 'Password reset was not successful. You must adhere to the password policy. Contact your admin for details.';
}
}
console.info(event);
document.getElementById('message').innerHTML = innerHtml;
form.remove();
document.getElementById('tryAgain').classList.remove('invisible');
} else {
Expand Down Expand Up @@ -49,10 +60,19 @@ window.addEventListener( 'load', function () {
XHR.addEventListener( 'load', function(event) {
hideSpinner();
if (event.target.status !== 204) {
console.info('error');
let innerHtml = 'There may be a problem. Try again later or contact the admin.';
if(event.target.status === 417) {
let responseMessage;
try {
responseMessage = JSON.parse(event.target.response);
innerHtml = `Password reset was not successful. ${responseMessage?.message}`;
} catch(e) {
innerHtml = 'Password reset was not successful. You must adhere to the password policy. Contact your admin for details.';
}
}
document.getElementById('message').classList.add('error');
document.getElementById('title').innerHTML = 'Uh oh...';
document.getElementById('message').innerHTML = 'There may be a problem. Try again later or contact the admin.';
document.getElementById('message').innerHTML = innerHtml;
} else {
document.getElementById('title').innerHTML = 'Check Your Email or Mobile Device';
const m1 = document.getElementById('message');
Expand Down

0 comments on commit 58753c7

Please sign in to comment.