2016-06-17 17:52:04 -07:00
|
|
|
|
define([], function () {
|
2016-10-22 22:11:46 -07:00
|
|
|
|
'use strict';
|
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.Action == 'ContactAdmin') {
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: Globalize.translate('MessageContactAdminToResetPassword'),
|
|
|
|
|
title: Globalize.translate('HeaderForgotPassword')
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.Action == 'InNetworkRequired') {
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: Globalize.translate('MessageForgotPasswordInNetworkRequired'),
|
|
|
|
|
title: Globalize.translate('HeaderForgotPassword')
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result.Action == 'PinCode') {
|
|
|
|
|
|
|
|
|
|
var msg = Globalize.translate('MessageForgotPasswordFileCreated');
|
|
|
|
|
|
|
|
|
|
msg += "<br/>";
|
|
|
|
|
msg += "<br/>";
|
|
|
|
|
msg += result.PinFile;
|
|
|
|
|
msg += "<br/>";
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
|
|
|
|
|
message: msg,
|
|
|
|
|
title: Globalize.translate('HeaderForgotPassword')
|
|
|
|
|
});
|
|
|
|
|
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'),
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
EnteredUsername: view.querySelector('#txtName').value
|
|
|
|
|
}
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
}).then(processForgotPasswordResult);
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-07-27 18:27:00 -07:00
|
|
|
|
|
2016-06-17 17:52:04 -07:00
|
|
|
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
|
|
|
|
};
|
2014-11-08 20:18:14 -07:00
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|