2016-03-19 05:26:17 +01:00
|
|
|
|
define(['jQuery'], function ($) {
|
2014-11-08 22:18:14 -05:00
|
|
|
|
|
|
|
|
|
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 23:17:23 -04:00
|
|
|
|
window.location.href = 'login.html';
|
2014-11-08 22:18:14 -05:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: Globalize.translate('MessageInvalidForgotPasswordPin'),
|
|
|
|
|
title: Globalize.translate('HeaderPasswordReset')
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-08 00:47:19 -04:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
|
|
|
|
|
var page = $(this).parents('.page');
|
2014-11-08 22:18:14 -05:00
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: ApiClient.getUrl('Users/ForgotPassword/Pin'),
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
Pin: $('#txtPin', page).val()
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 10:43:03 -05:00
|
|
|
|
}).then(function (result) {
|
2014-11-08 22:18:14 -05:00
|
|
|
|
|
|
|
|
|
processForgotPasswordResult(page, result);
|
|
|
|
|
});
|
2015-06-08 00:47:19 -04:00
|
|
|
|
return false;
|
2014-11-08 22:18:14 -05:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-07 12:53:58 -04:00
|
|
|
|
$(document).on('pageinit', '.forgotPasswordPinPage', function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('form', page).off('submit', onSubmit).on('submit', onSubmit);
|
2015-06-08 00:47:19 -04:00
|
|
|
|
});
|
2014-11-08 22:18:14 -05:00
|
|
|
|
|
2016-03-19 05:26:17 +01:00
|
|
|
|
});
|