@loomcore/api 0.1.139 → 0.1.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,12 +33,9 @@ export class AuthService extends MultiTenantApiService {
|
|
|
33
33
|
this.authConfig = config.auth;
|
|
34
34
|
}
|
|
35
35
|
async attemptLogin(req, res, email, password) {
|
|
36
|
-
console.log('auth service attemptLogin', email, password);
|
|
37
36
|
const lowerCaseEmail = email.toLowerCase();
|
|
38
37
|
const user = await this.getUserByEmail(lowerCaseEmail);
|
|
39
|
-
console.log('auth service attemptLogin user', user);
|
|
40
38
|
const organization = await this.organizationService.findOne(EmptyUserContext, { filters: { _id: { eq: user?._orgId } } });
|
|
41
|
-
console.log('auth service attemptLogin organization', organization);
|
|
42
39
|
if (!user) {
|
|
43
40
|
throw new BadRequestError('Invalid Credentials');
|
|
44
41
|
}
|
|
@@ -47,20 +44,15 @@ export class AuthService extends MultiTenantApiService {
|
|
|
47
44
|
throw new BadRequestError('Invalid Credentials');
|
|
48
45
|
}
|
|
49
46
|
const person = await this.personService.findOne(EmptyUserContext, { filters: { _id: { eq: user.personId } } });
|
|
50
|
-
console.log('auth service attemptLogin person', person);
|
|
51
47
|
const authorizations = await getUserContextAuthorizations(this.database, user);
|
|
52
|
-
console.log('auth service attemptLogin authorizations', authorizations);
|
|
53
48
|
const userContext = {
|
|
54
49
|
user: user,
|
|
55
50
|
person: person ?? undefined,
|
|
56
51
|
organization: organization ?? undefined,
|
|
57
52
|
authorizations: authorizations
|
|
58
53
|
};
|
|
59
|
-
console.log('auth service attemptLogin userContext', userContext);
|
|
60
54
|
const deviceId = this.getAndSetDeviceIdCookie(req, res);
|
|
61
|
-
console.log('auth service attemptLogin deviceId', deviceId);
|
|
62
55
|
const loginResponse = await this.logUserIn(userContext, deviceId);
|
|
63
|
-
console.log('auth service attemptLogin loginResponse', loginResponse);
|
|
64
56
|
return loginResponse;
|
|
65
57
|
}
|
|
66
58
|
async logUserIn(userContext, deviceId) {
|