Skip to content

Commit

Permalink
#771 Authentication Generic Errors (#775)
Browse files Browse the repository at this point in the history
* Display a generic erorr for wrong password or user not found

* Update SignIn.vue

replicating changes from local copy due to a 403 error

* adding lodash as explicit dependency

Co-authored-by: warrensearle <warren.searle@judicialappointments.digital>
  • Loading branch information
2 people authored and lloback committed Jul 20, 2021
1 parent 1436de1 commit d2a8a7a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"firebaseui": "^4.6.1",
"govuk-frontend": "^3.8.0",
"jspdf": "^1.5.3",
"lodash": "^4.17.21",
"logrocket": "^1.0.10",
"vue": "^2.6.11",
"vue-browser-detect-plugin": "^0.1.13",
Expand Down
10 changes: 9 additions & 1 deletion src/views/SignIn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import ErrorSummary from '@/components/Form/ErrorSummary';
import TextField from '@/components/Form/TextField';
import { auth } from '@/firebase';
import { get } from 'lodash';
export default {
components: {
Expand Down Expand Up @@ -125,7 +126,14 @@ export default {
}
})
.catch((error) => {
this.errors.push({ id: 'email', message: error.message });
switch (get(error, 'code', '')) {
case 'auth/user-not-found':
case 'auth/wrong-password':
this.errors.push({ id: 'email', message: 'The email address and/or password did not match our records. Please double-check and try again.' });
break;
default:
this.errors.push({ id: 'email', message: error.message });
}
});
}
},
Expand Down

0 comments on commit d2a8a7a

Please sign in to comment.