mirror of https://github.com/Squidex/squidex.git
20 changed files with 271 additions and 24 deletions
@ -0,0 +1,32 @@ |
|||||
|
// ==========================================================================
|
||||
|
// ExternalLogin.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
namespace Squidex.Read.Users |
||||
|
{ |
||||
|
public sealed class ExternalLogin |
||||
|
{ |
||||
|
public string LoginProvider { get; } |
||||
|
|
||||
|
public string ProviderKey { get; } |
||||
|
|
||||
|
public string ProviderDisplayName { get; } |
||||
|
|
||||
|
public ExternalLogin(string loginProvider, string providerKey, string providerDisplayName) |
||||
|
{ |
||||
|
LoginProvider = loginProvider; |
||||
|
|
||||
|
ProviderKey = providerKey; |
||||
|
ProviderDisplayName = providerDisplayName; |
||||
|
|
||||
|
if (string.IsNullOrWhiteSpace(ProviderDisplayName)) |
||||
|
{ |
||||
|
ProviderDisplayName = loginProvider; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Extensions.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.Security.Claims; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Identity; |
||||
|
using Squidex.Read.Users; |
||||
|
|
||||
|
namespace Squidex.Controllers.UI |
||||
|
{ |
||||
|
public static class Extensions |
||||
|
{ |
||||
|
public static async Task<ExternalLoginInfo> GetExternalLoginInfoWithDisplayNameAsync(this SignInManager<IUser> signInManager, string expectedXsrf = null) |
||||
|
{ |
||||
|
var externalLogin = await signInManager.GetExternalLoginInfoAsync(expectedXsrf); |
||||
|
|
||||
|
externalLogin.ProviderDisplayName = externalLogin.Principal.FindFirst(ClaimTypes.Email).Value; |
||||
|
|
||||
|
return externalLogin; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
// ==========================================================================
|
||||
|
// RemoveLoginModel.cs
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex Group
|
||||
|
// All rights reserved.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Squidex.Controllers.UI.Profile |
||||
|
{ |
||||
|
public class RemoveLoginModel |
||||
|
{ |
||||
|
[Required(ErrorMessage = "Login provider is required.")] |
||||
|
public string LoginProvider { get; set; } |
||||
|
|
||||
|
[Required(ErrorMessage = "Provider key.")] |
||||
|
public string ProviderKey { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
@{ |
||||
|
ViewBag.Title = "Account locked"; |
||||
|
} |
||||
|
|
||||
|
<h1 class="splash-h1">Access denied</h1> |
||||
|
|
||||
|
<p class="splash-text"> |
||||
|
This operation is not allowed. |
||||
|
</p> |
||||
|
|
||||
|
<p class="splash-text"> |
||||
|
<a href="~/identity-server/account/logout-redirect">Logout</a> |
||||
|
</p> |
||||
Loading…
Reference in new issue