mirror of
https://github.com/plankanban/planka.git
synced 2025-12-17 09:13:23 +03:00
fix: OIDC finalization and refactoring
This commit is contained in:
@@ -4,6 +4,9 @@ const zxcvbn = require('zxcvbn');
|
||||
const { getRemoteAddress } = require('../../../utils/remoteAddress');
|
||||
|
||||
const Errors = {
|
||||
NOT_ENOUGH_RIGHTS: {
|
||||
notEnoughRights: 'Not enough rights',
|
||||
},
|
||||
USER_NOT_FOUND: {
|
||||
userNotFound: 'User not found',
|
||||
},
|
||||
@@ -33,6 +36,9 @@ module.exports = {
|
||||
},
|
||||
|
||||
exits: {
|
||||
notEnoughRights: {
|
||||
responseType: 'forbidden',
|
||||
},
|
||||
userNotFound: {
|
||||
responseType: 'notFound',
|
||||
},
|
||||
@@ -58,8 +64,8 @@ module.exports = {
|
||||
throw Errors.USER_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (user.email === sails.config.custom.defaultAdminEmail) {
|
||||
throw Errors.USER_NOT_FOUND; // Forbidden
|
||||
if (user.email === sails.config.custom.defaultAdminEmail || user.isSso) {
|
||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user