From 751ee468a0f996da42bccc65a9dfee5a7b243352 Mon Sep 17 00:00:00 2001 From: Robert Zorko Date: Wed, 14 Oct 2015 15:29:12 +0200 Subject: moved the cahnged pass popup to its own screen and enabled the change pass btn in the profile screen --- js/codeq/profile.js | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'js/codeq/profile.js') diff --git a/js/codeq/profile.js b/js/codeq/profile.js index 08a8883..3f4a274 100644 --- a/js/codeq/profile.js +++ b/js/codeq/profile.js @@ -4,31 +4,7 @@ (function(){ - $('#formChangePassword').submit(function(event) { - var jqNew = $("#modalChangePasswordNew"), - jqVerify = $("#modalChangePasswordVerify"); - - if (jqNew.val() != jqVerify.val()) { - alert('Passwords do not match.'); - } - else { - codeq.comms.changePassword(jqNew.val()) - .then(function (data) { - if (data.code !== 0) throw new Error('Password change failed, code: ' + data.code + ', message: ' + data.message); - - $('#modalChangePassword').modal('hide'); - jqNew.val(''); - jqVerify.val(''); - alert('Password changed.'); - }) - .fail(function (reason) { - codeq.log.error('Password change failed: ' + reason, reason); - alert('Password change failed: ' + reason); - }) - .done(); - } - event.preventDefault(); // Prevent the form from submitting via the browser. - }); + var jqBtnChangePass = $("#change_pass_profile"); codeq.profile = { }; @@ -74,9 +50,13 @@ alert('GetUserStat failed: ' + reason); }) .done(); + jqBtnChangePass.on('click',function(){ + codeq.globalStateMachine.transition('changePassword'); + }); }, 'exit' : function(){ $("#screen_profile").css('display', 'none'); + jqBtnChangePass.off('click'); } }); })(); \ No newline at end of file -- cgit v1.2.1