Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Commit 2b1474b

Browse files
justinwraygsingh93
authored andcommitted
Fixed Login Form JS Bug (Fixes: #521) (#523)
* Login form JavaScript now properly retrieves and renders errors when invalid login credentials are provided. * Added teamLoginFormError() distinguished from teamNameFormError() and teamTokenFormError(). * Updated teamPasswordFormError() to read the login AJAX response and call the appropriate error function. * This PR fixes the bug identified in Issue #521.
1 parent 5d91ae9 commit 2b1474b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/static/js/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ function teamNameFormError() {
77
});
88
}
99

10+
function teamLoginFormError() {
11+
$('.el--text')[0].classList.add('form-error');
12+
$('.fb-form input').on('change', function() {
13+
$('.el--text')[0].classList.remove('form-error');
14+
});
15+
}
16+
1017
function teamPasswordFormError(toosimple) {
1118
$('.el--text')[1].classList.add('form-error');
1219
if (toosimple) {
@@ -115,11 +122,16 @@ function sendIndexRequest(request_data) {
115122
goToPage(responseData.redirect);
116123
} else {
117124
// TODO: Make this a modal
118-
verifyTeamName('register');
119125
if (responseData.message === 'Password too simple') {
120126
teamPasswordFormError(true);
121127
}
122-
teamTokenFormError();
128+
if (responseData.message === 'Login failed') {
129+
teamLoginFormError();
130+
}
131+
if (responseData.message === 'Registration failed') {
132+
teamNameFormError();
133+
teamTokenFormError();
134+
}
123135
}
124136
});
125137
}

0 commit comments

Comments
 (0)