jellyfin-web/dashboard-ui/scripts/forgotpasswordpin.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

(function (window) {
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 () {
2015-05-16 20:17:23 -07:00
window.location.href = 'login.html';
}
});
return;
}
Dashboard.alert({
message: Globalize.translate('MessageInvalidForgotPasswordPin'),
title: Globalize.translate('HeaderPasswordReset')
});
return;
}
2015-06-07 21:47:19 -07:00
function onSubmit() {
var page = $(this).parents('.page');
ApiClient.ajax({
type: 'POST',
url: ApiClient.getUrl('Users/ForgotPassword/Pin'),
dataType: 'json',
data: {
Pin: $('#txtPin', page).val()
}
2015-12-14 08:43:03 -07:00
}).then(function (result) {
processForgotPasswordResult(page, result);
});
2015-06-07 21:47:19 -07:00
return false;
}
2015-09-07 09:53:58 -07:00
$(document).on('pageinit', '.forgotPasswordPinPage', function () {
var page = this;
$('form', page).off('submit', onSubmit).on('submit', onSubmit);
2015-06-07 21:47:19 -07:00
});
})(window);