mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
copy dashboard to the output folder and load from the file system, instead of using embedded resources
This commit is contained in:
parent
799eebc9ed
commit
4dd9477bcd
137 changed files with 1424 additions and 1438 deletions
88
dashboard-ui/scripts/UpdatePasswordPage.js
Normal file
88
dashboard-ui/scripts/UpdatePasswordPage.js
Normal file
|
@ -0,0 +1,88 @@
|
|||
var UpdatePasswordPage = {
|
||||
|
||||
onPageShow: function () {
|
||||
UpdatePasswordPage.loadUser();
|
||||
},
|
||||
|
||||
loadUser: function() {
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
var userid = getParameterByName("userId");
|
||||
|
||||
ApiClient.getUser(userid).done(function (user) {
|
||||
|
||||
Dashboard.setPageTitle(user.Name);
|
||||
|
||||
if (user.HasPassword) {
|
||||
$('#btnResetPassword', page).show();
|
||||
} else {
|
||||
$('#btnResetPassword', page).hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#txtCurrentPassword', page).val('');
|
||||
$('#txtNewPassword', page).val('');
|
||||
$('#txtNewPasswordConfirm', page).val('');
|
||||
},
|
||||
|
||||
save: function () {
|
||||
|
||||
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 () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.alert("Password saved.");
|
||||
UpdatePasswordPage.loadUser();
|
||||
},
|
||||
|
||||
resetPassword: function () {
|
||||
|
||||
var msg = "Are you sure you wish to reset the password?";
|
||||
|
||||
Dashboard.confirm(msg, "Password Reset", function (result) {
|
||||
|
||||
if (result) {
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.resetUserPassword(userId).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert("The password has been reset.");
|
||||
UpdatePasswordPage.loadUser();
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
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);
|
Loading…
Add table
Add a link
Reference in a new issue