1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 13:49:43 +02:00

fix: OIDC finalization and refactoring

This commit is contained in:
Maksim Eltyshev 2023-10-17 19:18:19 +02:00
parent aae69cb5e4
commit 8e0c60f5be
70 changed files with 753 additions and 427 deletions

View file

@ -10,6 +10,9 @@ const Errors = {
INVALID_PASSWORD: {
invalidPassword: 'Invalid password',
},
USE_SINGLE_SIGN_ON: {
useSingleSignOn: 'Use single sign-on',
},
};
const emailOrUsernameValidator = (value) =>
@ -37,6 +40,9 @@ module.exports = {
invalidPassword: {
responseType: 'unauthorized',
},
useSingleSignOn: {
responseType: 'forbidden',
},
},
async fn(inputs) {
@ -44,6 +50,10 @@ module.exports = {
const user = await sails.helpers.users.getOneByEmailOrUsername(inputs.emailOrUsername);
if (user.isSso) {
throw Errors.USE_SINGLE_SIGN_ON;
}
if (!user) {
sails.log.warn(
`Invalid email or username: "${inputs.emailOrUsername}"! (IP: ${remoteAddress})`,