Support email login in simple auth

This commit is contained in:
Johannes Zellner
2016-03-31 16:59:44 +02:00
parent 915c37a72f
commit f413afb835
2 changed files with 34 additions and 1 deletions

View File

@@ -39,7 +39,8 @@ function loginLogic(clientId, username, password, callback) {
// only allow simple auth clients
if (clientObject.type !== clientdb.TYPE_SIMPLE_AUTH) return callback(new ClientsError(ClientsError.INVALID_CLIENT));
user.verify(username, password, function (error, userObject) {
var authFunction = (username.indexOf('@') === -1) ? user.verify : user.verifyWithEmail;
authFunction(username, password, function (error, userObject) {
if (error) return callback(error);
apps.get(clientObject.appId, function (error, appObject) {