diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-15 18:22:19 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-16 09:50:25 +0200 |
commit | e23e28b3cc311c9820462b38c6a7958027540dd7 (patch) | |
tree | 7e1022ca576dcfc7b9969858c45f6bfca55dd36b /settings/src/store | |
parent | bcffbab6f8afb29c9e5c8ef9861739febdb06a09 (diff) | |
download | nextcloud-server-e23e28b3cc311c9820462b38c6a7958027540dd7.tar.gz nextcloud-server-e23e28b3cc311c9820462b38c6a7958027540dd7.zip |
Various fixes
* Fixed subadmin group management
* Fixed pass policy prop retrieving
* Fixed fields subadmins were not supposed to see
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src/store')
-rw-r--r-- | settings/src/store/index.js | 3 | ||||
-rw-r--r-- | settings/src/store/users.js | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/settings/src/store/index.js b/settings/src/store/index.js index bf08e4aa390..43de49e2030 100644 --- a/settings/src/store/index.js +++ b/settings/src/store/index.js @@ -10,8 +10,9 @@ const debug = process.env.NODE_ENV !== 'production'; const mutations = { API_FAILURE(state, error) { - console.log(state, error); OC.Notification.showTemporary(t('settings','An error occured during the request. Unable to proceed.')); + // throw to raise exception of the promise and allow a `.then` in the Vue methods + throw error; } }; diff --git a/settings/src/store/users.js b/settings/src/store/users.js index 052a2918390..f349c7b4a06 100644 --- a/settings/src/store/users.js +++ b/settings/src/store/users.js @@ -213,9 +213,11 @@ const actions = { getPasswordPolicyMinLength(context) { - return api.get(OC.linkToOCS('apps/provisioning_api/api/v1/config/apps/password_policy/minLength', 2)) - .then((response) => context.commit('setPasswordPolicyMinLength', response.data.ocs.data.data)) - .catch((error) => context.commit('API_FAILURE', error)); + if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) { + context.commit('setPasswordPolicyMinLength', oc_capabilities.password_policy.minLength); + return oc_capabilities.password_policy.minLength; + } + return false; }, /** @@ -344,12 +346,12 @@ const actions = { * @param {string} options.quota User email * @returns {Promise} */ - addUser({context, dispatch}, { userid, password, email, groups, subadmin, quota, language }) { + addUser({commit, dispatch}, { userid, password, email, groups, subadmin, quota, language }) { return api.requireAdmin().then((response) => { return api.post(OC.linkToOCS(`cloud/users`, 2), { userid, password, email, groups, subadmin, quota, language }) .then((response) => dispatch('addUserData', userid)) .catch((error) => {throw error;}); - }).catch((error) => context.commit('API_FAILURE', { userid, error })); + }).catch((error) => commit('API_FAILURE', { userid, error })); }, /** |