Remove redundant client TYPE_*s

This commit is contained in:
Johannes Zellner
2016-06-08 14:09:06 +02:00
parent e954df2120
commit 4776a005a5
5 changed files with 11 additions and 25 deletions
+3 -7
View File
@@ -206,8 +206,7 @@ function loginForm(req, res) {
if (error) return sendError(req, res, 'Unknown OAuth client');
switch (result.type) {
case clients.TYPE_ADMIN: return render(constants.ADMIN_NAME, '/api/v1/cloudron/avatar');
case clients.TYPE_EXTERNAL: return render('External Application', '/api/v1/cloudron/avatar');
case clients.TYPE_EXTERNAL: return render(result.appId, '/api/v1/cloudron/avatar');
case clients.TYPE_SIMPLE_AUTH: return sendError(req, res, 'Unknown OAuth client');
default: break;
}
@@ -419,11 +418,8 @@ var authorization = [
// Handle our different types of oauth clients
var type = req.oauth2.client.type;
if (type === clients.TYPE_ADMIN) {
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req, 'admin'), { userId: req.oauth2.user.id });
return next();
} else if (type === clients.TYPE_EXTERNAL) {
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req, 'external'), { userId: req.oauth2.user.id });
if (type === clients.TYPE_EXTERNAL) {
eventlog.add(eventlog.ACTION_USER_LOGIN, auditSource(req, req.oauth2.client.appId), { userId: req.oauth2.user.id });
return next();
} else if (type === clients.TYPE_SIMPLE_AUTH) {
return sendError(req, res, 'Unknown OAuth client.');