Skip to content

Instantly share code, notes, and snippets.

@plutov
Last active January 8, 2018 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plutov/09e0a8a07163b9cc7e9dc6fc13f83bdb to your computer and use it in GitHub Desktop.
Save plutov/09e0a8a07163b9cc7e9dc6fc13f83bdb to your computer and use it in GitHub Desktop.
reset.js
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