Do not clear new user form on failure
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
ad1a026e54
commit
b28c42506f
|
@ -498,8 +498,20 @@ __webpack_require__.r(__webpack_exports__);
|
|||
language: this.newUser.language.code
|
||||
}).then(function () {
|
||||
return _this.resetForm();
|
||||
}).catch(function () {
|
||||
return _this.loading.all = false;
|
||||
}).catch(function (error) {
|
||||
_this.loading.all = false;
|
||||
|
||||
if (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) {
|
||||
var 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: function setNewUserDefaultGroup(value) {
|
||||
|
@ -687,6 +699,10 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
|||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
@ -1916,6 +1932,7 @@ var render = function() {
|
|||
expression: "newUser.id"
|
||||
}
|
||||
],
|
||||
ref: "newusername",
|
||||
attrs: {
|
||||
id: "newusername",
|
||||
type: "text",
|
||||
|
@ -1980,6 +1997,7 @@ var render = function() {
|
|||
expression: "newUser.password"
|
||||
}
|
||||
],
|
||||
ref: "newuserpassword",
|
||||
attrs: {
|
||||
id: "newuserpassword",
|
||||
type: "password",
|
||||
|
@ -2363,28 +2381,58 @@ var render = function() {
|
|||
}
|
||||
},
|
||||
[
|
||||
_c("input", {
|
||||
_vm.user.backendCapabilities.setDisplayName
|
||||
? [
|
||||
_vm.user.backendCapabilities.setDisplayName
|
||||
? _c("input", {
|
||||
ref: "displayName",
|
||||
attrs: {
|
||||
id: "displayName" + _vm.user.id + _vm.rand,
|
||||
type: "text",
|
||||
disabled: _vm.loading.displayName || _vm.loading.all,
|
||||
disabled:
|
||||
_vm.loading.displayName || _vm.loading.all,
|
||||
autocomplete: "new-password",
|
||||
autocorrect: "off",
|
||||
autocapitalize: "off",
|
||||
spellcheck: "false"
|
||||
},
|
||||
domProps: { value: _vm.user.displayname }
|
||||
}),
|
||||
})
|
||||
: _vm._e(),
|
||||
_vm._v(" "),
|
||||
_c("input", {
|
||||
_vm.user.backendCapabilities.setDisplayName
|
||||
? _c("input", {
|
||||
staticClass: "icon-confirm",
|
||||
attrs: { type: "submit", value: "" }
|
||||
})
|
||||
: _vm._e()
|
||||
]
|
||||
: _c(
|
||||
"div",
|
||||
{
|
||||
directives: [
|
||||
{
|
||||
name: "tooltip",
|
||||
rawName: "v-tooltip.auto",
|
||||
value: _vm.t(
|
||||
"settings",
|
||||
"The backend does not support changing the display name"
|
||||
),
|
||||
expression:
|
||||
"t('settings', 'The backend does not support changing the display name')",
|
||||
modifiers: { auto: true }
|
||||
}
|
||||
],
|
||||
staticClass: "name"
|
||||
},
|
||||
[_vm._v(_vm._s(_vm.user.displayname))]
|
||||
)
|
||||
],
|
||||
2
|
||||
),
|
||||
_vm._v(" "),
|
||||
_vm.settings.canChangePassword
|
||||
_vm.settings.canChangePassword &&
|
||||
_vm.user.backendCapabilities.setPassword
|
||||
? _c(
|
||||
"form",
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "settings",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -3300,7 +3300,8 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -3321,12 +3322,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -3341,17 +3344,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -3468,7 +3474,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -3480,6 +3487,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -3494,6 +3502,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -3501,12 +3510,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.2.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.1",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -3525,6 +3536,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -3605,7 +3617,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -3617,6 +3630,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -3702,7 +3716,8 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -3738,6 +3753,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -3757,6 +3773,7 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -3800,12 +3817,14 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "settings",
|
||||
"description": "Nextcloud settings",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"author": "John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>",
|
||||
"license": "AGPL3",
|
||||
"private": true,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue