summaryrefslogtreecommitdiff
path: root/js/codeq/change_password.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq/change_password.js')
-rw-r--r--js/codeq/change_password.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/js/codeq/change_password.js b/js/codeq/change_password.js
index 562f4b2..6311764 100644
--- a/js/codeq/change_password.js
+++ b/js/codeq/change_password.js
@@ -22,24 +22,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function(){
"use strict";
- var jqScreen = $('#screen-change-pass'),
+ var jqScreen = $('#screen-change-password'),
+ jqChangePassForm = $('#change-password-form'),
jqNew = $('#change-password-new'),
jqVerify = $('#change-password-verify'),
jqCancelBtn = $('#change-password-cancel'),
- jqChangePassForm = $('#change-password-form');
+ jqErrorMismatch = jqChangePassForm.find('.error.mismatch');
codeq.globalStateMachine.register('changePassword',{
'jqScreen': jqScreen,
'isModal': true,
- 'enter': function(){
+ 'enter': function() {
+ jqErrorMismatch.hide();
jqCancelBtn.on('click',function(){
history.back();//forces a transition to the previous state
});
- jqChangePassForm.on('submit',function(event) {
-
+ jqChangePassForm.on('submit', function (e) {
+ jqErrorMismatch.hide();
if (jqNew.val() != jqVerify.val()) {
- alert('Passwords do not match.');
+ jqErrorMismatch.show();
}
else {
codeq.comms.changePassword(jqNew.val())
@@ -54,7 +56,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
})
.done();
}
- event.preventDefault(); // Prevent the form from submitting via the browser.
+ e.preventDefault(); // Prevent the form from submitting via the browser.
});
@@ -62,6 +64,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
$('#disabled').css('display', 'none');
},
'exit' : function(){
+ jqErrorMismatch.hide();
jqChangePassForm.off('submit');
jqCancelBtn.off('click');
jqScreen.css('display', 'none');