fix: Unable to login with matching email from another auth provider (#4356)

* fix: Unable to login with matching email from another auth provider

* refactor
This commit is contained in:
Tom Moor
2022-10-29 16:46:29 -04:00
committed by GitHub
parent 79cbe304da
commit f6f90ff406
4 changed files with 88 additions and 51 deletions

View File

@@ -253,7 +253,7 @@ class Team extends ParanoidModel {
});
};
collectionIds = async function (paranoid = true) {
public collectionIds = async function (this: Team, paranoid = true) {
const models = await Collection.findAll({
attributes: ["id"],
where: {
@@ -267,7 +267,17 @@ class Team extends ParanoidModel {
return models.map((c) => c.id);
};
isDomainAllowed = async function (domain: string) {
/**
* Find whether the passed domain can be used to sign-in to this team. Note
* that this method always returns true if no domain restrictions are set.
*
* @param domain The domain to check
* @returns True if the domain is allowed to sign-in to this team
*/
public isDomainAllowed = async function (
this: Team,
domain: string
): Promise<boolean> {
const allowedDomains = (await this.$get("allowedDomains")) || [];
return (