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

71 lines
1.7 KiB
JavaScript
Raw Normal View History

(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/>";
Dashboard.alert({
message: msg,
title: Globalize.translate('HeaderForgotPassword')
});
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'),
dataType: 'json',
data: {
EnteredUsername: $('#txtName', page).val()
}
}).done(function (result) {
processForgotPasswordResult(page, result);
});
2015-06-07 21:47:19 -07:00
return false;
}
2015-09-01 07:01:59 -07:00
$(document).on('pageinit', '#forgotPasswordPage', function () {
2015-07-27 18:27:00 -07:00
var page = this;
$('.forgotPasswordForm', page).off('submit', onSubmit).on('submit', onSubmit);
2015-06-07 21:47:19 -07:00
});
})(window);