mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
define([], function () {
|
|
|
|
function processForgotPasswordResult(result) {
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
return function (view, params) {
|
|
|
|
function onSubmit(e) {
|
|
|
|
ApiClient.ajax({
|
|
|
|
type: 'POST',
|
|
url: ApiClient.getUrl('Users/ForgotPassword'),
|
|
dataType: 'json',
|
|
data: {
|
|
EnteredUsername: view.querySelector('#txtName').value
|
|
}
|
|
|
|
}).then(processForgotPasswordResult);
|
|
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
|
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
|
};
|
|
|
|
}); |