LDAP first login BUG fixed

This commit is contained in:
root 2019-08-21 08:24:33 +02:00
parent 3e374db722
commit 6beac55826
2 changed files with 6 additions and 2 deletions

View file

@ -195,7 +195,7 @@ if (LdapStrategy) {
} catch (err) { } catch (err) {
if (err instanceof interoperableErrors.NotFoundError) { if (err instanceof interoperableErrors.NotFoundError) {
const userId = await users.create(null, { const userId = await users.create(contextHelpers.getAdminContext(), {
username: profile[config.ldap.uidTag], username: profile[config.ldap.uidTag],
role: config.ldap.newUserRole, role: config.ldap.newUserRole,
namespace: config.ldap.newUserNamespaceId namespace: config.ldap.newUserNamespaceId

View file

@ -258,7 +258,11 @@ async function getByAccessToken(accessToken) {
} }
async function getByUsername(username) { async function getByUsername(username) {
try{
return await _getBy(contextHelpers.getAdminContext(), 'username', username); return await _getBy(contextHelpers.getAdminContext(), 'username', username);
}catch(err){
throw new interoperableErrors.NotFoundError();
}
} }
async function getByUsernameIfPasswordMatch(context, username, password) { async function getByUsernameIfPasswordMatch(context, username, password) {