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

add optional password field on user creation

This commit is contained in:
dkanada 2019-06-30 01:52:57 -07:00
parent 24250cb4b0
commit 2609bda89d
3 changed files with 17 additions and 18 deletions

View file

@ -29,7 +29,8 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
}
function loadUser(page) {
$("#txtUserName", page).val("");
$("#txtUsername", page).val("");
$("#txtPassword", page).val("");
loading.show();
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
IsHidden: false
@ -43,8 +44,10 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
}
function saveUser(page) {
var name = $("#txtUserName", page).val();
ApiClient.createUser(name).then(function(user) {
var user = {};
user.Name = $("#txtUsername", page).val();
user.Password = $("#txtPassword", page).val();
ApiClient.createUser(user).then(function(user) {
user.Policy.EnableAllFolders = $("#chkEnableAllFolders", page).checked();
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : $(".chkFolder", page).get().filter(function(i) {
return i.checked
@ -61,15 +64,9 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
Dashboard.navigate("useredit.html?userId=" + user.Id);
});
}, function(response) {
if (response.status == 400) {
Dashboard.alert({
message: page.querySelector(".labelNewUserNameHelp").innerHTML
});
} else {
require(["toast"], function(toast) {
toast(Globalize.translate("DefaultErrorMessage"));
});
}
require(["toast"], function(toast) {
toast(Globalize.translate("DefaultErrorMessage"));
});
loading.hide();
});
}