diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-22 11:29:20 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-22 13:58:15 +0100 |
commit | b28c42506f0eb71d35401b29ed42048e1be883e0 (patch) | |
tree | 71fd20095d04f12574268066e095329982fca253 /settings/src | |
parent | ad1a026e547d2092783e545f854ea34065d0bdb2 (diff) | |
download | nextcloud-server-b28c42506f0eb71d35401b29ed42048e1be883e0.tar.gz nextcloud-server-b28c42506f0eb71d35401b29ed42048e1be883e0.zip |
Do not clear new user form on failure
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src')
-rw-r--r-- | settings/src/components/userList.vue | 21 | ||||
-rw-r--r-- | settings/src/store/users.js | 5 |
2 files changed, 21 insertions, 5 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue index 521ad7cc392..48c8b9d7b86 100644 --- a/settings/src/components/userList.vue +++ b/settings/src/components/userList.vue @@ -51,7 +51,7 @@ <input id="newusername" type="text" required v-model="newUser.id" :placeholder="t('settings', 'Username')" name="username" autocomplete="off" autocapitalize="none" autocorrect="off" - pattern="[a-zA-Z0-9 _\.@\-']+"> + ref="newusername" pattern="[a-zA-Z0-9 _\.@\-']+"> </div> <div class="displayName"> <input id="newdisplayname" type="text" v-model="newUser.displayName" @@ -60,7 +60,7 @@ </div> <div class="password"> <input id="newuserpassword" type="password" v-model="newUser.password" - :required="newUser.mailAddress===''" + :required="newUser.mailAddress===''" ref="newuserpassword" :placeholder="t('settings', 'Password')" name="password" autocomplete="new-password" autocapitalize="none" autocorrect="off" :minlength="minPasswordLength"> @@ -335,8 +335,21 @@ export default { subadmin: this.newUser.subAdminsGroups.map(group => group.id), quota: this.newUser.quota.id, language: this.newUser.language.code, - }).then(() => this.resetForm()) - .catch(() => this.loading.all = false); + }) + .then(() => this.resetForm()) + .catch((error) => { + this.loading.all = false; + if (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) { + const statuscode = error.response.data.ocs.meta.statuscode + if (statuscode === 102) { + // wrong username + this.$refs.newusername.focus(); + } else if (statuscode === 107) { + // wrong password + this.$refs.newuserpassword.focus(); + } + } + }); }, setNewUserDefaultGroup(value) { if (value && value.length > 0) { diff --git a/settings/src/store/users.js b/settings/src/store/users.js index ba2611b3eec..ff59dfbc8ad 100644 --- a/settings/src/store/users.js +++ b/settings/src/store/users.js @@ -431,7 +431,10 @@ const actions = { return api.post(OC.linkToOCS(`cloud/users`, 2), { userid, password, displayName, email, groups, subadmin, quota, language }) .then((response) => dispatch('addUserData', userid)) .catch((error) => {throw error;}); - }).catch((error) => commit('API_FAILURE', { userid, error })); + }).catch((error) => { + commit('API_FAILURE', { userid, error }); + throw error; + }); }, /** |