Last active
January 8, 2018 02:48
-
-
Save plutov/09e0a8a07163b9cc7e9dc6fc13f83bdb to your computer and use it in GitHub Desktop.
reset.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function alterForgotPasswordScreen() { | |
var $dialog = $('.gigya-screen-dialog, .gigya-screen-dialog-mobile'), | |
$form = $dialog.find('form[name="gigya-forgot-password-form"]'), | |
$email = $form.find('input[name="username"]'); | |
$email.focus(function() { | |
showUpdatePasswordError(''); | |
}); | |
$form.submit(function (e) { | |
e.preventDefault(); | |
if( !$email.val() || !$email.val().trim() ) { | |
showUpdatePasswordError('Please enter your Email address'); | |
return; | |
} | |
gigya.accounts.resetPassword({ | |
loginID: $email.val(), | |
callback: function (response) { | |
if (response.status === 'OK') { | |
showAccountScreenSet('forgot-password-success'); | |
} else { | |
switch (parseInt(response.errorCode)) { | |
case 400002: | |
showUpdatePasswordError('Please enter your Email address'); | |
break; | |
case 403047: | |
showUpdatePasswordError('Your email does not exist in our system. Please try again.'); | |
break; | |
default: | |
showUpdatePasswordError(response.errorDetails); | |
} | |
} | |
} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment