-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from DimensionSrl/feature/updates
Improves email check on login
- Loading branch information
Showing
5 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ final class LoadUserInfoViewModel { | |
guard let userEmail = userInfo.email | ||
else { return false } | ||
|
||
return userEmail == person.email || | ||
return person.hasEmail(userEmail) || | ||
userEmail == "[email protected]" || | ||
userEmail.hasSuffix("@dimension.it") | ||
} | ||
|
@@ -104,3 +104,12 @@ final class LoadUserInfoViewModel { | |
) | ||
} | ||
} | ||
|
||
private extension Person { | ||
|
||
func hasEmail(_ email: String) -> Bool { | ||
let emails = [primaryEmail, secondaryEmail, tertiaryEmail].compactMap { $0 } | ||
return emails.contains { $0.compare(email, options: .caseInsensitive) == .orderedSame } | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters