mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-10-12 06:57:06 +02:00
global: add null safety checks
This commit is contained in:
1 parent
be432dfd24
commit
6e35edb715
109 files changed
+452
-590
No files matched your search
@@ -24,8 +24,10 @@ namespace Microsoft.AspNetCore.Identity
|
||||
{
|
||||
public static class UserManagerExtensions
|
||||
{
|
||||
public static async Task<User> FindRegisteredUserAsync(this UserManager<User> userManager, string email, string clientId)
|
||||
public static async Task<User?> FindRegisteredUserAsync(this UserManager<User> userManager, string? email, string clientId)
|
||||
{
|
||||
if (email == null) return null;
|
||||
|
||||
var user = await userManager.FindByEmailAsync(email);
|
||||
return user != null && await userManager.IsInRoleAsync(user, clientId) ? user : null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user