mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
add optional password field on user creation
This commit is contained in:
parent
24250cb4b0
commit
2609bda89d
@ -1190,15 +1190,13 @@ define(["events", "appStorage"], function(events, appStorage) {
|
|||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
})
|
})
|
||||||
}, ApiClient.prototype.createUser = function(name) {
|
}, ApiClient.prototype.createUser = function(user) {
|
||||||
var url = this.getUrl("Users/New");
|
var url = this.getUrl("Users/New");
|
||||||
return this.ajax({
|
return this.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: {
|
data: JSON.stringify(user),
|
||||||
Name: name
|
contentType: "application/json"
|
||||||
},
|
|
||||||
dataType: "json"
|
|
||||||
})
|
})
|
||||||
}, ApiClient.prototype.updateUser = function(user) {
|
}, ApiClient.prototype.updateUser = function(user) {
|
||||||
if (!user) throw new Error("null user");
|
if (!user) throw new Error("null user");
|
||||||
|
@ -29,7 +29,8 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadUser(page) {
|
function loadUser(page) {
|
||||||
$("#txtUserName", page).val("");
|
$("#txtUsername", page).val("");
|
||||||
|
$("#txtPassword", page).val("");
|
||||||
loading.show();
|
loading.show();
|
||||||
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
|
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", {
|
||||||
IsHidden: false
|
IsHidden: false
|
||||||
@ -43,8 +44,10 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveUser(page) {
|
function saveUser(page) {
|
||||||
var name = $("#txtUserName", page).val();
|
var user = {};
|
||||||
ApiClient.createUser(name).then(function(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.EnableAllFolders = $("#chkEnableAllFolders", page).checked();
|
||||||
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : $(".chkFolder", page).get().filter(function(i) {
|
user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : $(".chkFolder", page).get().filter(function(i) {
|
||||||
return i.checked
|
return i.checked
|
||||||
@ -61,15 +64,9 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox"], function($, loading)
|
|||||||
Dashboard.navigate("useredit.html?userId=" + user.Id);
|
Dashboard.navigate("useredit.html?userId=" + user.Id);
|
||||||
});
|
});
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
if (response.status == 400) {
|
|
||||||
Dashboard.alert({
|
|
||||||
message: page.querySelector(".labelNewUserNameHelp").innerHTML
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
require(["toast"], function(toast) {
|
require(["toast"], function(toast) {
|
||||||
toast(Globalize.translate("DefaultErrorMessage"));
|
toast(Globalize.translate("DefaultErrorMessage"));
|
||||||
});
|
});
|
||||||
}
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<input is="emby-input" id="txtUserName" required type="text" label="${LabelName}" />
|
<input is="emby-input" id="txtUsername" required type="text" label="${LabelName}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inputContainer">
|
||||||
|
<input is="emby-input" id="txtPassword" type="password" label="${LabelPassword}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user