Browse Source

Login page

pull/1/head
Sebastian 9 years ago
parent
commit
e9abbf954e
  1. 7
      src/Squidex/Configurations/Identity/IdentityServices.cs
  2. 7
      src/Squidex/Modules/UI/Account/AccountController.cs
  3. 9
      src/Squidex/Views/Account/Error.cshtml
  4. 30
      src/Squidex/Views/Account/Login.cshtml

7
src/Squidex/Configurations/Identity/IdentityServices.cs

@ -9,6 +9,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using IdentityServer4.Configuration;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using IdentityServer4.Stores.InMemory;
@ -45,7 +46,11 @@ namespace Squidex.Configurations.Identity
services.AddSingleton<IScopeStore,
InMemoryScopeStore>();
services.AddIdentityServer().SetSigningCredential(certificate)
services.AddIdentityServer(options =>
{
options.UserInteractionOptions.ErrorUrl = "/account/error/";
})
.SetSigningCredential(certificate)
.AddAspNetIdentity<IdentityUser>();
return services;

7
src/Squidex/Modules/UI/Account/AccountController.cs

@ -52,6 +52,13 @@ namespace Squidex.Modules.UI.Account
return View();
}
[HttpGet]
[Route("account/error/")]
public IActionResult Error()
{
return View();
}
[HttpGet]
[Route("account/login/")]
public IActionResult Login(string returnUrl = null)

9
src/Squidex/Views/Account/Error.cshtml

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Squidex - Login failed</title>
</head>
<body>
<h1>Login failed</h1>
</body>
</html>

30
src/Squidex/Views/Account/Login.cshtml

@ -3,13 +3,23 @@
@using Microsoft.AspNetCore.Http.Authentication
@model Squidex.Modules.UI.Account.LoginVM
<form asp-controller="Account" asp-action="External" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in Model.ExternalProviders)
{
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
}
</p>
</div>
</form>
<!DOCTYPE html>
<html>
<head>
<title>Squidex - Login</title>
</head>
<body>
<form asp-controller="Account" asp-action="External" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in Model.ExternalProviders)
{
<button type="submit" class="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
}
</p>
</div>
</form>
</body>
</html>

Loading…
Cancel
Save