mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
wizarduserpage.js
This commit is contained in:
parent
e192f1f3c6
commit
e0cf014197
1 changed files with 15 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
|||
define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "emby-button"], function(loading, globalize) {
|
||||
define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "emby-button"], function (loading, globalize) {
|
||||
"use strict";
|
||||
|
||||
function getApiClient() {
|
||||
|
@ -30,13 +30,15 @@ define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "em
|
|||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
|
||||
if (form.querySelector("#txtManualPassword").value != form.querySelector("#txtPasswordConfirm").value) {
|
||||
require(["toast"], function(toast) {
|
||||
require(["toast"], function (toast) {
|
||||
toast(Globalize.translate("PasswordMatchError"));
|
||||
});
|
||||
} else {
|
||||
submit(form);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
@ -45,20 +47,21 @@ define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "em
|
|||
loading.show();
|
||||
var page = this;
|
||||
var apiClient = getApiClient();
|
||||
apiClient.getJSON(apiClient.getUrl("Startup/User")).then(function(user) {
|
||||
apiClient.getJSON(apiClient.getUrl("Startup/User")).then(function (user) {
|
||||
page.querySelector("#txtUsername").value = user.Name || "";
|
||||
page.querySelector("#txtManualPassword").value = user.Password || "";
|
||||
loading.hide();
|
||||
})
|
||||
}
|
||||
return function(view, params) {
|
||||
view.querySelector(".wizardUserForm").addEventListener("submit", onSubmit);
|
||||
view.addEventListener("viewshow", function() {
|
||||
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader")
|
||||
});
|
||||
view.addEventListener("viewhide", function() {
|
||||
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
view.querySelector(".wizardUserForm").addEventListener("submit", onSubmit);
|
||||
view.addEventListener("viewshow", function () {
|
||||
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader");
|
||||
});
|
||||
view.addEventListener("viewhide", function () {
|
||||
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader");
|
||||
});
|
||||
view.addEventListener("viewshow", onViewShow);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue