Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Opserver/Controllers/LoginController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using StackExchange.Opserver.Helpers;
using StackExchange.Opserver.Views.Login;
using Roles = StackExchange.Opserver.Models.Roles;
using StackExchange.Opserver.Models.Security;

namespace StackExchange.Opserver.Controllers
{
Expand All @@ -14,6 +15,10 @@ public ActionResult Login(string returnUrl)
if (returnUrl == "/")
return RedirectToAction(nameof(Login));

if (Current.Security is EveryonesAnAdminProvider
|| Current.Security is EveryonesReadOnlyProvider)
return View("AutoLogin");

var vd = new LoginModel();
return View(vd);
}
Expand Down
1 change: 1 addition & 0 deletions Opserver/Opserver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@
<Content Include="Views\SQL\Databases.Modal.Partitions.cshtml">
<DependentUpon>Databases.Modal.cshtml</DependentUpon>
</Content>
<Content Include="Views\Login\AutoLogin.cshtml" />
<Content Include="Views\SQL\AllJobs.cshtml" />
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions Opserver/Views/Login/AutoLogin.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<body onload="document.autoLogin.submit()">
<form action="~/login" method="POST" name="autoLogin">
<input type="hidden" name="url" value="@Request.QueryString["ReturnUrl"]" />
</form>
</body>
</html>