mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
define(['jQuery'], function ($) {
|
|
|
|
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 () {
|
|
|
|
window.location.href = 'login.html';
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
Dashboard.alert({
|
|
|
|
message: Globalize.translate('MessageInvalidForgotPasswordPin'),
|
|
title: Globalize.translate('HeaderPasswordReset')
|
|
});
|
|
return;
|
|
}
|
|
|
|
function onSubmit() {
|
|
|
|
var page = $(this).parents('.page');
|
|
|
|
ApiClient.ajax({
|
|
|
|
type: 'POST',
|
|
url: ApiClient.getUrl('Users/ForgotPassword/Pin'),
|
|
dataType: 'json',
|
|
data: {
|
|
Pin: $('#txtPin', page).val()
|
|
}
|
|
|
|
}).then(function (result) {
|
|
|
|
processForgotPasswordResult(page, result);
|
|
});
|
|
return false;
|
|
}
|
|
|
|
$(document).on('pageinit', '.forgotPasswordPinPage', function () {
|
|
|
|
var page = this;
|
|
|
|
$('form', page).off('submit', onSubmit).on('submit', onSubmit);
|
|
});
|
|
|
|
}); |