Merge branch 'fix/login-add-link' into 'develop'

Add link to the docs when a non-admin user logs in

See merge request pleroma/admin-fe!111
This commit is contained in:
Angelina Filippova 2020-03-29 19:58:38 +00:00
commit 34f14c93f7
2 changed files with 6 additions and 2 deletions

View file

@ -34,9 +34,10 @@ export const beforeEachRoute = (to, from, next) => {
}).catch((err) => {
store.dispatch('FedLogOut').then(() => {
Message({
dangerouslyUseHTMLString: true,
message: err,
type: 'error',
duration: 7 * 1000
duration: 10 * 1000
})
next({ path: '/' })
})

View file

@ -81,6 +81,9 @@ const user = {
return new Promise((resolve, reject) => {
getUserInfo(state.token, state.authHost).then(response => {
const data = response.data
const message = '<span>This user doesn\`t have admin rights. Try another credentials or see the </span>' +
'<u><a target="_blank" href="https://docs.pleroma.social/backend/administration/CLI_tasks/user/#set-the-value-of-the-given-users-settings">docs</a></u>' +
'<span> to find out how to make this user an admin</span>'
if (!data) {
reject('Verification failed, please login again.')
@ -89,7 +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 run `MIX_ENV=prod mix pleroma.user set NICKNAME --admin`')
reject(message)
}
commit('SET_NAME', data.username)