mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
update password page to new js format
This commit is contained in:
parent
9e3190a060
commit
05a6467c35
@ -12,7 +12,7 @@
|
||||
<a href="#" data-role="button" class="ui-btn-active">Profile</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('updatepassword.html', true);">Password</a>
|
||||
<a class="lnkMediaLibrary" style="display:none;" href="#" data-role="button" onclick="Dashboard.navigate('library.html', true);">Media Library</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('library.html', true);" class="lnkMediaLibrary" style="display:none;">Media Library</a>
|
||||
</div>
|
||||
<form id="editUserProfileForm">
|
||||
<ul data-role="listview" class="ulForm">
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
function loadUser(page, user, loggedInUser, parentalRatingsPromise, allCulturesPromise) {
|
||||
|
||||
if (loggedInUser.Configuration.IsAdministrator) {
|
||||
$('.lnkMediaLibrary', page).show();
|
||||
}
|
||||
|
||||
if (!loggedInUser.Configuration.IsAdministrator || user.Id == loggedInUser.Id) {
|
||||
|
||||
$('#fldIsAdmin', page).hide();
|
||||
@ -155,12 +151,10 @@
|
||||
|
||||
window.EditUserPage = new editUserPage();
|
||||
|
||||
$(document).on('pageshow', "#editUserPage", function () {
|
||||
$(document).on('pagebeforeshow', "#editUserPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
if (userId) {
|
||||
@ -169,6 +163,23 @@
|
||||
$('#userProfileNavigation', page).hide();
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (loggedInUser) {
|
||||
|
||||
if (loggedInUser.Configuration.IsAdministrator) {
|
||||
$('.lnkMediaLibrary', page).show().prev().removeClass('ui-last-child');
|
||||
} else {
|
||||
$('.lnkMediaLibrary', page).hide().prev().addClass('ui-last-child');
|
||||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#editUserPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
var promise1;
|
||||
|
||||
if (!userId) {
|
||||
|
@ -1,11 +1,6 @@
|
||||
var UpdatePasswordPage = {
|
||||
(function ($, document, window) {
|
||||
|
||||
onPageShow: function () {
|
||||
UpdatePasswordPage.loadUser();
|
||||
},
|
||||
|
||||
loadUser: function() {
|
||||
var page = $.mobile.activePage;
|
||||
function loadUser(page) {
|
||||
|
||||
var userid = getParameterByName("userId");
|
||||
|
||||
@ -28,31 +23,55 @@
|
||||
$('#txtCurrentPassword', page).val('');
|
||||
$('#txtNewPassword', page).val('');
|
||||
$('#txtNewPasswordConfirm', page).val('');
|
||||
},
|
||||
}
|
||||
|
||||
save: function () {
|
||||
function save(page) {
|
||||
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
var page = $($.mobile.activePage);
|
||||
var currentPassword = $('#txtCurrentPassword', page).val();
|
||||
var newPassword = $('#txtNewPassword', page).val();
|
||||
|
||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).done(UpdatePasswordPage.saveComplete);
|
||||
},
|
||||
|
||||
saveComplete: function () {
|
||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.alert("Password saved.");
|
||||
UpdatePasswordPage.loadUser();
|
||||
},
|
||||
loadUser(page);
|
||||
|
||||
resetPassword: function () {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function updatePasswordPage() {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.onSubmit = function () {
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
if ($('#txtNewPassword', page).val() != $('#txtNewPasswordConfirm', page).val()) {
|
||||
|
||||
Dashboard.showError("Password and password confirmation must match.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
save(page);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
self.resetPassword = function () {
|
||||
|
||||
var msg = "Are you sure you wish to reset the password?";
|
||||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
Dashboard.confirm(msg, "Password Reset", function (result) {
|
||||
|
||||
if (result) {
|
||||
@ -64,29 +83,36 @@
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert("The password has been reset.");
|
||||
UpdatePasswordPage.loadUser();
|
||||
loadUser(page);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onSubmit: function () {
|
||||
var page = $($.mobile.activePage);
|
||||
|
||||
if ($('#txtNewPassword', page).val() != $('#txtNewPasswordConfirm', page).val()) {
|
||||
|
||||
Dashboard.showError("Password and password confirmation must match.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
UpdatePasswordPage.save();
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#updatePasswordPage", UpdatePasswordPage.onPageShow);
|
||||
window.UpdatePasswordPage = new updatePasswordPage();
|
||||
|
||||
$(document).on('pagebeforeshow', "#updatePasswordPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.getCurrentUser().done(function (loggedInUser) {
|
||||
|
||||
if (loggedInUser.Configuration.IsAdministrator) {
|
||||
$('.lnkMediaLibrary', page).show().prev().removeClass('ui-last-child');
|
||||
} else {
|
||||
$('.lnkMediaLibrary', page).hide().prev().addClass('ui-last-child');
|
||||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#updatePasswordPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
loadUser(page);
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document, window);
|
@ -21,6 +21,12 @@
|
||||
|
||||
var page = $($.mobile.activePage);
|
||||
|
||||
if (user.Configuration.IsAdministrator) {
|
||||
$('.lnkMediaLibrary', page).show();
|
||||
} else {
|
||||
$('.lnkMediaLibrary', page).hide();
|
||||
}
|
||||
|
||||
$('#uploadUserImage', page).val('').trigger('change');
|
||||
|
||||
Dashboard.setPageTitle(user.Name);
|
||||
|
@ -12,7 +12,7 @@
|
||||
<a href="#" onclick="Dashboard.navigate('edituser.html', true);" data-role="button">Profile</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||
<a href="#" data-role="button" class="ui-btn-active">Password</a>
|
||||
<a href="#" data-role="button" onclick="Dashboard.navigate('library.html', true);">Media Library</a>
|
||||
<a href="#" data-role="button" class="lnkMediaLibrary" style="display:none;" onclick="Dashboard.navigate('library.html', true);">Media Library</a>
|
||||
</div>
|
||||
<h3 style="display: none;">Create Password</h3>
|
||||
<form id="updatePasswordForm">
|
||||
|
Loading…
Reference in New Issue
Block a user