oidc by default aus, oidc Button nur wenn oidc aktiviert, release pipeline
This commit is contained in:
@@ -6,18 +6,26 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Watcher.Data;
|
||||
using Watcher.ViewModels;
|
||||
|
||||
namespace Watcher.Controllers;
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
public Boolean oidc { get; set; }
|
||||
}
|
||||
|
||||
public class AuthController : Controller
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
private readonly AppSettings _settings;
|
||||
|
||||
public AuthController(AppDbContext context)
|
||||
public AuthController(AppDbContext context, IOptions<AppSettings> options)
|
||||
{
|
||||
_context = context;
|
||||
_settings = options.Value;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -27,6 +35,8 @@ public class AuthController : Controller
|
||||
{
|
||||
ReturnUrl = returnUrl
|
||||
};
|
||||
|
||||
ViewBag.oidc = _settings.oidc;
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/_LoginLayout.cshtml";
|
||||
ViewData["Title"] = "Login";
|
||||
var oidc = ViewBag.oidc;
|
||||
}
|
||||
|
||||
<style>
|
||||
@@ -79,9 +80,13 @@
|
||||
|
||||
<hr class="my-4" />
|
||||
|
||||
<form asp-controller="Auth" asp-action="SignIn" method="get">
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
|
||||
</div>
|
||||
</form>
|
||||
@if (ViewBag.oidc)
|
||||
{
|
||||
<form asp-controller="Auth" asp-action="SignIn" method="get">
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
|
||||
</div>
|
||||
</form>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
"Authentication": {
|
||||
"UseLocal": true,
|
||||
"PocketIDEnabled": true,
|
||||
"PocketIDEnabled": false,
|
||||
"PocketID": {
|
||||
"Authority": "https://pocketid.triggermeelmo.com",
|
||||
"ClientId": "629a5f42-ab02-4905-8311-cc7b64165cc0",
|
||||
|
Reference in New Issue
Block a user