2023-03-28 22:04:56 +02:00
|
|
|
@page
|
|
|
|
@using AutheliaMultiDomainProxy.Backend
|
|
|
|
@using System.Web
|
|
|
|
@model IndexModel
|
|
|
|
@{
|
2023-03-28 23:12:09 +02:00
|
|
|
// Check if we are on an allowed domain
|
2023-03-28 23:48:54 +02:00
|
|
|
if (Vars.PermittedDomains.All(p => Request.Host.Host != $"{Vars.AuthProxySubdomain}.{p}")) {
|
2023-03-28 22:04:56 +02:00
|
|
|
Layout = null;
|
|
|
|
Response.Clear();
|
|
|
|
Response.StatusCode = StatusCodes.Status421MisdirectedRequest;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ViewData["Title"] = "Home";
|
|
|
|
|
|
|
|
var authStatus = AuthHelpers.IsAuthenticated(Request.Cookies);
|
|
|
|
}
|
|
|
|
|
|
|
|
<div class="text-center">
|
|
|
|
<h1 class="display-4">Welcome</h1>
|
|
|
|
@if (authStatus is { isAuthenticated: true,user: { } }) {
|
|
|
|
<p>
|
|
|
|
You are currently <span class="badge bg-success">authenticated as @authStatus.user</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<form method="POST" action="/api/logout">
|
|
|
|
<button type="submit" class="btn btn-danger">Log out</button>
|
|
|
|
</form>
|
|
|
|
}
|
|
|
|
else if (authStatus.isAuthenticated) {
|
|
|
|
<p>You are currently <span class="badge bg-success">authenticated</span> (no username known, no actions available)</p>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
<p>You are currently <span class="badge bg-danger">not authenticated</span></p>
|
2023-04-05 20:28:28 +02:00
|
|
|
<a href="https://@Vars.AuthProxySubdomain.@Vars.UpstreamPrimaryDomain/api/cookieproxy_stage_one/?tgt=@HttpUtility.UrlEncode($"https://{Request.Host.Host}")" class="btn btn-success">Log in</a>
|
2023-03-28 22:04:56 +02:00
|
|
|
}
|
|
|
|
</div>
|