2014-11-08 20:18:14 -07:00
|
|
|
|
(function (window) {
|
|
|
|
|
|
|
|
|
|
function processForgotPasswordResult(page, result) {
|
|
|
|
|
|
|
|
|
|
if (result.Success) {
|
|
|
|
|
|
|
|
|
|
var msg = Globalize.translate('MessagePasswordResetForUsers');
|
|
|
|
|
|
|
|
|
|
msg += '<br/>';
|
|
|
|
|
msg += '<br/>';
|
|
|
|
|
msg += result.UsersReset.join('<br/>');
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: msg,
|
|
|
|
|
title: Globalize.translate('HeaderPasswordReset'),
|
|
|
|
|
|
|
|
|
|
callback: function () {
|
|
|
|
|
|
2015-05-16 20:17:23 -07:00
|
|
|
|
window.location.href = 'login.html';
|
2014-11-08 20:18:14 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: Globalize.translate('MessageInvalidForgotPasswordPin'),
|
|
|
|
|
title: Globalize.translate('HeaderPasswordReset')
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 21:47:19 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
|
|
|
|
|
var page = $(this).parents('.page');
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: ApiClient.getUrl('Users/ForgotPassword/Pin'),
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
Pin: $('#txtPin', page).val()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).done(function (result) {
|
|
|
|
|
|
|
|
|
|
processForgotPasswordResult(page, result);
|
|
|
|
|
});
|
2015-06-07 21:47:19 -07:00
|
|
|
|
return false;
|
2014-11-08 20:18:14 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', '#forgotPasswordPinPage', function () {
|
2015-06-07 21:47:19 -07:00
|
|
|
|
$('.forgotPasswordPinForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
});
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
|
|
|
|
})(window);
|