Vary page layout for registering new accounts

address #1138
This commit is contained in:
Umar Bolatov 2019-11-08 22:38:37 -08:00
parent ae9b93ca8f
commit dfdb99165b
No known key found for this signature in database
GPG Key ID: 2C1F9AEB371D2A28
3 changed files with 7 additions and 3 deletions

View File

@ -364,7 +364,7 @@ namespace BTCPayServer.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
public async Task<IActionResult> Register(string returnUrl = null, bool logon = true) public async Task<IActionResult> Register(string returnUrl = null, bool logon = true, bool useBasicLayout = false)
{ {
var policies = await _SettingsRepository.GetSettingAsync<PoliciesSettings>() ?? new PoliciesSettings(); var policies = await _SettingsRepository.GetSettingAsync<PoliciesSettings>() ?? new PoliciesSettings();
if (policies.LockSubscription && !User.IsInRole(Roles.ServerAdmin)) if (policies.LockSubscription && !User.IsInRole(Roles.ServerAdmin))
@ -372,6 +372,7 @@ namespace BTCPayServer.Controllers
ViewData["ReturnUrl"] = returnUrl; ViewData["ReturnUrl"] = returnUrl;
ViewData["Logon"] = logon.ToString(CultureInfo.InvariantCulture).ToLowerInvariant(); ViewData["Logon"] = logon.ToString(CultureInfo.InvariantCulture).ToLowerInvariant();
ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration; ViewData["AllowIsAdmin"] = _Options.AllowAdminRegistration;
ViewData["UseBasicLayout"] = useBasicLayout;
return View(); return View();
} }

View File

@ -1,10 +1,12 @@
@model RegisterViewModel @model RegisterViewModel
@{ @{
ViewData["Title"] = "Register"; ViewData["Title"] = "Register";
Layout = "_WelcomeLayout.cshtml"; var useBasicLayout = ViewData["UseBasicLayout"] is true;
Layout = useBasicLayout ? "../Shared/_Layout.cshtml" : "_WelcomeLayout.cshtml";
} }
<div class="modal-dialog modal-login"> <!-- We want to center the dialog box in case we are not using the Welcome layout -->
<div class="modal-dialog @(useBasicLayout ? "modal-dialog-centered" : "")">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">Create account</h4> <h4 class="modal-title">Create account</h4>

View File

@ -12,6 +12,7 @@
asp-action="Register" asp-action="Register"
asp-route-returnUrl="@Context.Request.GetCurrentPath()" asp-route-returnUrl="@Context.Request.GetCurrentPath()"
asp-route-logon="false" asp-route-logon="false"
asp-route-useBasicLayout="true"
class="btn btn-primary" class="btn btn-primary"
role="button"> role="button">
<span class="fa fa-plus"></span> Add User <span class="fa fa-plus"></span> Add User