2016-06-17 17:52:04 -07:00
|
|
|
|
define([], function () {
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
function processForgotPasswordResult(result) {
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
return function (view, params) {
|
2015-06-07 21:47:19 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
function onSubmit(e) {
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
ApiClient.ajax({
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
type: 'POST',
|
|
|
|
|
url: ApiClient.getUrl('Users/ForgotPassword/Pin'),
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
Pin: view.querySelector('#txtPin').value
|
|
|
|
|
}
|
2015-09-07 09:53:58 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
}).then(processForgotPasswordResult);
|
2015-09-07 09:53:58 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
|
|
|
|
};
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|