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:
parent
aae69cb5e4
commit
8e0c60f5be
70 changed files with 753 additions and 427 deletions
|
@ -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})`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue