Merge pull request #4674 from thornbill/wizard-user-password
Require passwords when creating an admin user in the startup wizard
This commit is contained in:
commit
8d3a88d0e5
3 changed files with 28 additions and 14 deletions
|
@ -11,11 +11,11 @@
|
||||||
<div class="fieldDescription">${SelectAdminUsername}</div>
|
<div class="fieldDescription">${SelectAdminUsername}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<input is="emby-input" id="txtManualPassword" type="password" label="${LabelPassword}" />
|
<input is="emby-input" id="txtManualPassword" type="password" label="${LabelPassword}" required="required" />
|
||||||
<div class="fieldDescription">${LeaveBlankToNotSetAPassword}</div>
|
<div class="fieldDescription">${PasswordRequiredForAdmin}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<input is="emby-input" id="txtPasswordConfirm" type="password" label="${LabelPasswordConfirm}" />
|
<input is="emby-input" id="txtPasswordConfirm" type="password" label="${LabelPasswordConfirm}" required="required" />
|
||||||
</div>
|
</div>
|
||||||
<p>${MoreUsersCanBeAddedLater}</p>
|
<p>${MoreUsersCanBeAddedLater}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,27 +11,40 @@ function getApiClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextWizardPage() {
|
function nextWizardPage() {
|
||||||
Dashboard.navigate('wizardlibrary.html');
|
Dashboard.navigate('wizardlibrary.html')
|
||||||
|
.catch(err => {
|
||||||
|
console.error('[Wizard > User] error navigating to library setup', err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUpdateUserComplete(result) {
|
function onUpdateUserComplete(result) {
|
||||||
console.debug('user update complete: ' + result);
|
console.debug('[Wizard > User] user update complete:', result);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
nextWizardPage();
|
nextWizardPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onUpdateUserError(result) {
|
||||||
|
const message = await result.text();
|
||||||
|
console.warn('[Wizard > User] user update failed:', message);
|
||||||
|
toast(globalize.translate('ErrorDefault'));
|
||||||
|
loading.hide();
|
||||||
|
}
|
||||||
|
|
||||||
function submit(form) {
|
function submit(form) {
|
||||||
loading.show();
|
loading.show();
|
||||||
const apiClient = getApiClient();
|
const apiClient = getApiClient();
|
||||||
apiClient.ajax({
|
apiClient
|
||||||
type: 'POST',
|
.ajax({
|
||||||
data: JSON.stringify({
|
type: 'POST',
|
||||||
Name: form.querySelector('#txtUsername').value,
|
data: JSON.stringify({
|
||||||
Password: form.querySelector('#txtManualPassword').value
|
Name: form.querySelector('#txtUsername').value,
|
||||||
}),
|
Password: form.querySelector('#txtManualPassword').value
|
||||||
url: apiClient.getUrl('Startup/User'),
|
}),
|
||||||
contentType: 'application/json'
|
url: apiClient.getUrl('Startup/User'),
|
||||||
}).then(onUpdateUserComplete);
|
contentType: 'application/json'
|
||||||
|
})
|
||||||
|
.then(onUpdateUserComplete)
|
||||||
|
.catch(onUpdateUserError);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
|
|
@ -1287,6 +1287,7 @@
|
||||||
"PackageInstallFailed": "{0} (version {1}) installation failed.",
|
"PackageInstallFailed": "{0} (version {1}) installation failed.",
|
||||||
"ParentalRating": "Parental rating",
|
"ParentalRating": "Parental rating",
|
||||||
"PasswordMatchError": "Password and password confirmation must match.",
|
"PasswordMatchError": "Password and password confirmation must match.",
|
||||||
|
"PasswordRequiredForAdmin": "A password is required for admin accounts.",
|
||||||
"PasswordResetComplete": "The password has been reset.",
|
"PasswordResetComplete": "The password has been reset.",
|
||||||
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
|
||||||
"PasswordResetProviderHelp": "Pick a password reset provider to be used when this user requests a password reset.",
|
"PasswordResetProviderHelp": "Pick a password reset provider to be used when this user requests a password reset.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue