1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

support in-home easy password

This commit is contained in:
Luke Pulverenti 2015-01-29 01:06:24 -05:00
parent 340fcbb607
commit 27b770b898
3 changed files with 117 additions and 9 deletions

View file

@ -248,7 +248,15 @@
$('.passwordSection', page).show();
}
$('#chkEnableLocalAccessWithoutPassword', page).checked(user.Configuration.EnableLocalPassword).checkboxradio('refresh');
if (user.HasConfiguredEasyPassword) {
$('#txtEasyPassword', page).val('').attr('placeholder', '******');
$('#btnResetEasyPassword', page).show();
} else {
$('#txtEasyPassword', page).val('').attr('placeholder', '');
$('#btnResetEasyPassword', page).hide();
}
$('#chkEnableLocalEasyPassword', page).checked(user.Configuration.EnableLocalPassword).checkboxradio('refresh');
});
$('#txtCurrentPassword', page).val('');
@ -256,13 +264,30 @@
$('#txtNewPasswordConfirm', page).val('');
}
function save(page) {
function saveEasyPassword(page) {
var userId = getParameterByName("userId");
var easyPassword = $('#txtEasyPassword', page).val();
if (easyPassword) {
ApiClient.updateEasyPassword(userId, easyPassword).done(function () {
onEasyPasswordSaved(page, userId);
});
} else {
onEasyPasswordSaved(page, userId);
}
}
function onEasyPasswordSaved(page, userId) {
ApiClient.getUser(userId).done(function (user) {
user.Configuration.EnableLocalPassword = $('#chkEnableLocalAccessWithoutPassword', page).checked();
user.Configuration.EnableLocalPassword = $('#chkEnableLocalEasyPassword', page).checked();
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
@ -321,7 +346,7 @@
Dashboard.showLoadingMsg();
save(page);
saveEasyPassword(page);
// Disable default form submission
return false;
@ -357,6 +382,36 @@
});
};
self.resetEasyPassword = function () {
var msg = Globalize.translate('PinCodeResetConfirmation');
var page = $.mobile.activePage;
Dashboard.confirm(msg, Globalize.translate('HeaderPinCodeReset'), function (result) {
if (result) {
var userId = getParameterByName("userId");
Dashboard.showLoadingMsg();
ApiClient.resetEasyPassword(userId).done(function () {
Dashboard.hideLoadingMsg();
Dashboard.alert({
message: Globalize.translate('PinCodeResetComplete'),
title: Globalize.translate('HeaderPinCodeReset')
});
loadUser(page);
});
}
});
};
}
window.UpdatePasswordPage = new updatePasswordPage();