Skip to content

Commit

Permalink
template: additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Nov 14, 2024
1 parent a8f4b4e commit 9be2bd5
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
using Coalesce.Starter.Vue.Data.Models;
using IntelliTect.Coalesce.Models;
using Microsoft.AspNetCore.Authentication;
#if GoogleAuth
using Microsoft.AspNetCore.Authentication.Google;
#endif
#if MicrosoftAuth
using Microsoft.AspNetCore.Authentication.MicrosoftAccount;
#endif
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -29,7 +33,7 @@ ILogger<ExternalLoginModel> logger
public string? ReturnUrl { get; set; }

public string? ErrorMessage { get; set; }

public IActionResult OnGet() => RedirectToPage("Login");

public IActionResult OnPost(string provider)
Expand Down Expand Up @@ -131,7 +135,7 @@ private async Task<IActionResult> OnMicrosoftTicketReceived(ExternalLoginInfo in
#if UserPictures
// Populate or update user photo from Microsoft Graph
await UpdateUserPhoto(user,
HttpContext.RequestServices.GetRequiredService<IOptions<MicrosoftAccountOptions>>().Value.Backchannel,
HttpContext.RequestServices.GetRequiredService<IOptions<MicrosoftAccountOptions>>().Value.Backchannel,
() =>
{
var request = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me/photos/96x96/$value");
Expand Down Expand Up @@ -229,10 +233,10 @@ string externalTenantId
if (tenant is null)
{
// Automatically create a tenant in our application based on the external tenant.
db.Tenants.Add(tenant = new()
db.Tenants.Add(tenant = new()
{
ExternalId = externalId,
Name = user.Email?.Split('@').Last() ?? externalId
ExternalId = externalId,
Name = user.Email?.Split('@').Last() ?? externalId
});
await db.SaveChangesAsync();

Expand Down

0 comments on commit 9be2bd5

Please sign in to comment.