Skip to content

Commit a73ee70

Browse files
committed
[server] don't match by email addresses
1 parent 7409c16 commit a73ee70

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

components/server/src/auth/generic-auth-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ export class GenericAuthProvider implements AuthProvider {
434434
}
435435
} else {
436436
// no user session present, let's initiate a login
437-
currentGitpodUser = await this.userService.findUserForLogin({ candidate, primaryEmail });
437+
currentGitpodUser = await this.userService.findUserForLogin({ candidate });
438438
}
439439

440440
const token = this.createToken(this.tokenUsername, accessToken, refreshToken, currentScopes, tokenResponse.expires_in);

components/server/src/user/user-service.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,8 @@ export class UserService {
211211
return false;
212212
}
213213

214-
/**
215-
* Try to find the Gitpod user ...
216-
* 1. by identity
217-
* 2. by email
218-
*/
219-
async findUserForLogin(params: { candidate: Identity, primaryEmail?: string }) {
214+
async findUserForLogin(params: { candidate: Identity }) {
220215
let user = await this.userDb.findUserByIdentity(params.candidate);
221-
if (!user && params.primaryEmail) {
222-
// - findUsersByEmail is supposed to return users ordered descending by last login time
223-
// - we pick the most recently used one and let the old onces "dry out"
224-
const usersWithPrimaryEmail = await this.userDb.findUsersByEmail(params.primaryEmail);
225-
if (usersWithPrimaryEmail.length > 0) {
226-
user = usersWithPrimaryEmail[0];
227-
}
228-
}
229216
return user;
230217
}
231218

0 commit comments

Comments
 (0)