Skip to content

Commit 022a70a

Browse files
authored
feat(templates): assume social signed-in users as confirmed user by default #10239 (#10240)
1 parent fdbeb6e commit 022a70a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Controllers/Identity/IdentityController.SocialSignIn.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ public async Task<ActionResult> SocialSignInCallback(string? returnUrl = null, i
5050

5151
if (user is null)
5252
{
53+
var name = info.Principal.FindFirstValue(ClaimTypes.Name) ?? info.Principal.FindFirstValue(ClaimTypes.NameIdentifier);
5354
// Instead of automatically creating a user here, you can navigate to the sign-up page and pass the email and phone number in the query string.
5455

55-
user = new() { LockoutEnabled = true };
56+
user = new()
57+
{
58+
FullName = name,
59+
LockoutEnabled = true
60+
};
5661

5762
await userStore.SetUserNameAsync(user, Guid.NewGuid().ToString(), cancellationToken);
5863

src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Services/Identity/AppUserConfirmation.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ public partial class AppUserConfirmation : IUserConfirmation<User>
66
{
77
public async Task<bool> IsConfirmedAsync(UserManager<User> manager, User user)
88
{
9-
return user.EmailConfirmed || user.PhoneNumberConfirmed;
9+
return user.EmailConfirmed ||
10+
user.PhoneNumberConfirmed ||
11+
(await manager.GetLoginsAsync(user)).Any();
1012
}
1113
}

0 commit comments

Comments
 (0)