oidc: Give proper login error feedback

This commit is contained in:
Johannes Zellner
2023-05-12 14:31:26 +02:00
parent 61aa32d8c5
commit da7fbeee3d
2 changed files with 32 additions and 8 deletions
+5 -4
View File
@@ -391,7 +391,7 @@ function renderInteractionPage(provider) {
if (app) {
options.name = app.label || app.fqdn;
// options.iconUrl = app.iconUrl;
options.iconUrl = app.iconUrl;
}
return res.render('login', options);
@@ -409,7 +409,7 @@ function renderInteractionPage(provider) {
const user = await users.get(session.accountId);
options.name = app.label || app.fqdn;
// options.iconUrl = app.iconUrl;
options.iconUrl = app.iconUrl;
options.hasAccess = apps.canAccess(app, user);
} else {
options.hasAccess = true;
@@ -451,9 +451,9 @@ function interactionLogin(provider) {
const [verifyError, user] = await safe(verifyFunc(username, password, users.AP_WEBADMIN, { totpToken }));
if (verifyError && verifyError.reason === BoxError.INVALID_CREDENTIALS) return next(new HttpError(401, verifyError.message));
if (verifyError && verifyError.reason === BoxError.NOT_FOUND) return next(new HttpError(401, 'Unauthorized'));
if (verifyError && verifyError.reason === BoxError.NOT_FOUND) return next(new HttpError(401, 'Username and password does not match'));
if (verifyError) return next(new HttpError(500, verifyError));
if (!user) return next(new HttpError(401, 'Unauthorized'));
if (!user) return next(new HttpError(401, 'Username and password does not match'));
// TODO we may have to check what else the Account class provides, in which case we have to map those things
const result = {
@@ -728,6 +728,7 @@ async function start() {
app.get (`${ROUTE_PREFIX}/interaction/:uid/abort`, setNoCache, interactionAbort(provider));
app.use(ROUTE_PREFIX, provider.callback());
app.use(middleware.lastMile());
await util.promisify(gHttpServer.listen.bind(gHttpServer))(constants.OIDC_PORT, '127.0.0.1');
}