Merge branch 'fix/login-without-roles' into 'develop'

Make error message more user-friendly when non-admin user tries to log in

Closes #87

See merge request pleroma/admin-fe!109
This commit is contained in:
Angelina Filippova 2020-03-26 19:46:51 +00:00
commit c7ebd70069
2 changed files with 6 additions and 2 deletions

View file

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

View file

@ -89,7 +89,7 @@ const user = {
if (data.pleroma && data.pleroma.is_admin) { if (data.pleroma && data.pleroma.is_admin) {
commit('SET_ROLES', ['admin']) commit('SET_ROLES', ['admin'])
} else { } else {
reject('getInfo: roles must be a non-null array!') reject('This user doesn\`t have admin rights. Try another credentials or run `MIX_ENV=prod mix pleroma.user set NICKNAME --admin`')
} }
commit('SET_NAME', data.username) commit('SET_NAME', data.username)