diff --git a/src/controllers/wizard/user/index.html b/src/controllers/wizard/user/index.html index 785c9d894..62c2eb9c5 100644 --- a/src/controllers/wizard/user/index.html +++ b/src/controllers/wizard/user/index.html @@ -11,11 +11,11 @@
${SelectAdminUsername}
- -
${LeaveBlankToNotSetAPassword}
+ +
${PasswordRequiredForAdmin}
- +

${MoreUsersCanBeAddedLater}

diff --git a/src/controllers/wizard/user/index.js b/src/controllers/wizard/user/index.js index d6647f735..ac6238a93 100644 --- a/src/controllers/wizard/user/index.js +++ b/src/controllers/wizard/user/index.js @@ -11,27 +11,40 @@ function getApiClient() { } 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) { - console.debug('user update complete: ' + result); + console.debug('[Wizard > User] user update complete:', result); loading.hide(); 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) { loading.show(); const apiClient = getApiClient(); - apiClient.ajax({ - type: 'POST', - data: JSON.stringify({ - Name: form.querySelector('#txtUsername').value, - Password: form.querySelector('#txtManualPassword').value - }), - url: apiClient.getUrl('Startup/User'), - contentType: 'application/json' - }).then(onUpdateUserComplete); + apiClient + .ajax({ + type: 'POST', + data: JSON.stringify({ + Name: form.querySelector('#txtUsername').value, + Password: form.querySelector('#txtManualPassword').value + }), + url: apiClient.getUrl('Startup/User'), + contentType: 'application/json' + }) + .then(onUpdateUserComplete) + .catch(onUpdateUserError); } function onSubmit(e) { diff --git a/src/strings/en-us.json b/src/strings/en-us.json index eb2fc0680..5cc2db0ca 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1287,6 +1287,7 @@ "PackageInstallFailed": "{0} (version {1}) installation failed.", "ParentalRating": "Parental rating", "PasswordMatchError": "Password and password confirmation must match.", + "PasswordRequiredForAdmin": "A password is required for admin accounts.", "PasswordResetComplete": "The password has been reset.", "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.",