From b5aba2cc812280358203dde2a50c4dcf366bdb2f Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 29 Mar 2020 22:21:09 +0300 Subject: [PATCH 1/2] Link to docs when a non-admin user tries to log in --- src/permission.js | 1 + src/store/modules/user.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/permission.js b/src/permission.js index 892f487f..bb0abce8 100644 --- a/src/permission.js +++ b/src/permission.js @@ -34,6 +34,7 @@ export const beforeEachRoute = (to, from, next) => { }).catch((err) => { store.dispatch('FedLogOut').then(() => { Message({ + dangerouslyUseHTMLString: true, message: err, type: 'error', duration: 7 * 1000 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 762826c7..c8d3c03a 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -89,7 +89,9 @@ const user = { if (data.pleroma && data.pleroma.is_admin) { commit('SET_ROLES', ['admin']) } else { - reject('This user doesn\`t have admin rights. Try another credentials or run `MIX_ENV=prod mix pleroma.user set NICKNAME --admin`') + reject('This user doesn\`t have admin rights. Try another credentials or see ' + + 'docs' + + ' to find out how to make this user an admin') } commit('SET_NAME', data.username) From 2c8270f24c58079fbb779f884033f8ef1927d2e9 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 29 Mar 2020 22:52:32 +0300 Subject: [PATCH 2/2] Put message in a variable --- src/permission.js | 2 +- src/store/modules/user.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/permission.js b/src/permission.js index bb0abce8..b7c82f5c 100644 --- a/src/permission.js +++ b/src/permission.js @@ -37,7 +37,7 @@ export const beforeEachRoute = (to, from, next) => { dangerouslyUseHTMLString: true, message: err, type: 'error', - duration: 7 * 1000 + duration: 10 * 1000 }) next({ path: '/' }) }) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c8d3c03a..861d4192 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -81,6 +81,9 @@ const user = { return new Promise((resolve, reject) => { getUserInfo(state.token, state.authHost).then(response => { const data = response.data + const message = 'This user doesn\`t have admin rights. Try another credentials or see the ' + + 'docs' + + ' to find out how to make this user an admin' if (!data) { reject('Verification failed, please login again.') @@ -89,9 +92,7 @@ const user = { if (data.pleroma && data.pleroma.is_admin) { commit('SET_ROLES', ['admin']) } else { - reject('This user doesn\`t have admin rights. Try another credentials or see ' + - 'docs' + - ' to find out how to make this user an admin') + reject(message) } commit('SET_NAME', data.username)