Skip to content

Commit 9be2bd5

Browse files
committed
template: additional fixes
1 parent a8f4b4e commit 9be2bd5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

templates/Coalesce.Vue.Template/content/Coalesce.Starter.Vue.Web/Pages/ExternalLogin.cshtml.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
using Coalesce.Starter.Vue.Data.Models;
33
using IntelliTect.Coalesce.Models;
44
using Microsoft.AspNetCore.Authentication;
5+
#if GoogleAuth
56
using Microsoft.AspNetCore.Authentication.Google;
7+
#endif
8+
#if MicrosoftAuth
69
using Microsoft.AspNetCore.Authentication.MicrosoftAccount;
10+
#endif
711
using Microsoft.AspNetCore.Authorization;
812
using Microsoft.AspNetCore.Identity;
913
using Microsoft.AspNetCore.Mvc;
@@ -29,7 +33,7 @@ ILogger<ExternalLoginModel> logger
2933
public string? ReturnUrl { get; set; }
3034

3135
public string? ErrorMessage { get; set; }
32-
36+
3337
public IActionResult OnGet() => RedirectToPage("Login");
3438

3539
public IActionResult OnPost(string provider)
@@ -131,7 +135,7 @@ private async Task<IActionResult> OnMicrosoftTicketReceived(ExternalLoginInfo in
131135
#if UserPictures
132136
// Populate or update user photo from Microsoft Graph
133137
await UpdateUserPhoto(user,
134-
HttpContext.RequestServices.GetRequiredService<IOptions<MicrosoftAccountOptions>>().Value.Backchannel,
138+
HttpContext.RequestServices.GetRequiredService<IOptions<MicrosoftAccountOptions>>().Value.Backchannel,
135139
() =>
136140
{
137141
var request = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/photos/96x96/$value");
@@ -229,10 +233,10 @@ string externalTenantId
229233
if (tenant is null)
230234
{
231235
// Automatically create a tenant in our application based on the external tenant.
232-
db.Tenants.Add(tenant = new()
236+
db.Tenants.Add(tenant = new()
233237
{
234-
ExternalId = externalId,
235-
Name = user.Email?.Split('@').Last() ?? externalId
238+
ExternalId = externalId,
239+
Name = user.Email?.Split('@').Last() ?? externalId
236240
});
237241
await db.SaveChangesAsync();
238242

0 commit comments

Comments
 (0)