mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #941 - Rework password recovery and remove IsLocal checks
This commit is contained in:
parent
0adfd30015
commit
7f6f74fb54
11 changed files with 263 additions and 40 deletions
74
dashboard-ui/scripts/forgotpassword.js
Normal file
74
dashboard-ui/scripts/forgotpassword.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
(function (window) {
|
||||
|
||||
function processForgotPasswordResult(page, 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/>";
|
||||
msg += "<br/>";
|
||||
msg += Globalize.translate('MessageForgotPasswordFileExpiration', parseISO8601Date(result.PinExpirationDate, { toLocal: true }).toLocaleString());
|
||||
|
||||
Dashboard.alert({
|
||||
|
||||
message: msg,
|
||||
title: Globalize.translate('HeaderForgotPassword')
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit(page) {
|
||||
|
||||
ApiClient.ajax({
|
||||
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('Users/ForgotPassword'),
|
||||
dataType: 'json',
|
||||
data: {
|
||||
EnteredUsername: $('#txtName', page).val()
|
||||
}
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
processForgotPasswordResult(page, result);
|
||||
});
|
||||
}
|
||||
|
||||
window.ForgotPasswordPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
onSubmit(page);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})(window);
|
Loading…
Add table
Add a link
Reference in a new issue