Browse Source

Build fix.

pull/625/head
Sebastian 5 years ago
parent
commit
e223fdf095
  1. 18
      backend/i18n/source/backend_en.json
  2. 48
      backend/src/Squidex.Shared/Texts.it.resx
  3. 48
      backend/src/Squidex.Shared/Texts.nl.resx
  4. 48
      backend/src/Squidex.Shared/Texts.resx
  5. 1
      backend/src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs
  6. 3
      backend/src/Squidex/Areas/IdentityServer/Controllers/Account/LoginVM.cs
  7. 17
      backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs
  8. 8
      backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupVM.cs
  9. 48
      backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml
  10. 140
      backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml
  11. 35
      backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs
  12. 4
      frontend/app/theme/_common.scss

18
backend/i18n/source/backend_en.json

@ -45,6 +45,7 @@
"common.clientSecret": "Client Secret",
"common.contentType": "Content type",
"common.contributorId": "Contributor ID or email",
"common.critical": "Critial",
"common.data": "Data",
"common.defaultValue": "Default value",
"common.displayName": "Display name",
@ -112,8 +113,10 @@
"common.save": "Save",
"common.schemaId": "Schema ID",
"common.signup": "Signup",
"common.success": "Success",
"common.text": "Text",
"common.trigger": "Trigger",
"common.warning": "Warning",
"common.workflow": "Workflow",
"common.workflowStep": "Step",
"common.workflowTransition": "Transition",
@ -277,15 +280,20 @@
"setup.createUser.loginHint": "You have configured at least one external authentication provider such as Google. Just go to the login page and login to become administrator.",
"setup.createUser.loginLink": "Go to Login Page.",
"setup.createUser.separator": "OR",
"setup.headline": "One Time Installation",
"setup.headline": "Installation",
"setup.hint": "You are seeing this screen because no user exists yet. After a user is created, you are not able to use this screen again.",
"setup.https.failure": " You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the <code>X-Forwarded-*</code> headers.",
"setup.https.success": "Congratulations, you are accessing your Squidex installation over a secure connection (https).",
"setup.madeBy": "Proudly made by",
"setup.madeByCopyright": "Sebastian Stehle and Contributors, 2016-2021",
"setup.ruleAppCreation.warningAdmins": "With your setup, only admins can create new apps. If you want to change this set <code>UI__ONLYADMINSCANCREATEAPPS=false</code> as environment variable.",
"setup.ruleAppCreation.warningAll": "With your setup, every user can create new apps. If you want to change this set <code>UI__ONLYADMINSCANCREATEAPPS=true</code> as environment variable.",
"setup.ruleFolder.warning": "You are using the <strong>folder asset store</strong> where all assets are stored in the file system. Please remember to include the asset folder into your backup strategy and map it to a volume, if you are using Docker.",
"setup.ruleFtp.warning": "You are using the <strong>FTP asset store</strong>. It is not recommended to use this storage type because of bad performance.",
"setup.ruleHttps.failure": " You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the <code>X-Forwarded-*</code> headers.",
"setup.ruleHttps.success": "Congratulations, you are accessing your Squidex installation over a secure connection (https).",
"setup.rules.headline": "System Checklist",
"setup.ruleUrl.failure": "You should access Squidex only over one one canonical URL and configure this URL over the <code>URLS__BASEURL</code> environment variable. The current base URL <code>{actual}</code> does not match to the base url <code>{configured}</code>.",
"setup.ruleUrl.success": "Congratulations the <code>URLS__BASEURL</code> environment variable is configured properly.",
"setup.title": "Installation",
"setup.url.failure": "You should access Squidex only over one one canonical URL and configure this URL over the <code>URLS__BASEURL</code> environment variable. The current base URL <code>{actual}</code> does not match to the base url <code>{configured}</code>.",
"setup.url.success": "Congratulations the <code>URLS__BASEURL</code> environment variable is configured properly.",
"users.accessDenied.text": "This operation is not allowed, your account might be locked.",
"users.accessDenied.title": "Access denied",
"users.consent.agree": "I agree!",

48
backend/src/Squidex.Shared/Texts.it.resx

@ -220,6 +220,9 @@
<data name="common.contributorId" xml:space="preserve">
<value>ID o Email del collaboratore</value>
</data>
<data name="common.critical" xml:space="preserve">
<value>Critial</value>
</data>
<data name="common.data" xml:space="preserve">
<value>Data</value>
</data>
@ -421,12 +424,18 @@
<data name="common.signup" xml:space="preserve">
<value>Iscriviti</value>
</data>
<data name="common.success" xml:space="preserve">
<value>Success</value>
</data>
<data name="common.text" xml:space="preserve">
<value>Testo</value>
</data>
<data name="common.trigger" xml:space="preserve">
<value>Trigger</value>
</data>
<data name="common.warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="common.workflow" xml:space="preserve">
<value>Workflow</value>
</data>
@ -917,16 +926,10 @@
<value>OR</value>
</data>
<data name="setup.headline" xml:space="preserve">
<value>One Time Installation</value>
<value>Installation</value>
</data>
<data name="setup.hint" xml:space="preserve">
<value>You are seeing this screen because no user exists yet. After a user is created you are not able to use this screen again.</value>
</data>
<data name="setup.https.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.https.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
<value>You are seeing this screen because no user exists yet. After a user is created, you are not able to use this screen again.</value>
</data>
<data name="setup.madeBy" xml:space="preserve">
<value>Proudly made by</value>
@ -934,15 +937,36 @@
<data name="setup.madeByCopyright" xml:space="preserve">
<value>Sebastian Stehle and Contributors, 2016-2021</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
<data name="setup.ruleAppCreation.warningAdmins" xml:space="preserve">
<value>With your setup, only admins can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=false&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.ruleAppCreation.warningAll" xml:space="preserve">
<value>With your setup, every user can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=true&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.url.failure" xml:space="preserve">
<data name="setup.ruleFolder.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;folder asset store&lt;/strong&gt; where all assets are stored in the file system. Please remember to include the asset folder into your backup strategy and map it to a volume, if you are using Docker.</value>
</data>
<data name="setup.ruleFtp.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;FTP asset store&lt;/strong&gt;. It is not recommended to use this storage type because of bad performance.</value>
</data>
<data name="setup.ruleHttps.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.ruleHttps.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
</data>
<data name="setup.rules.headline" xml:space="preserve">
<value>System Checklist</value>
</data>
<data name="setup.ruleUrl.failure" xml:space="preserve">
<value>You should access Squidex only over one one canonical URL and configure this URL over the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value>
</data>
<data name="setup.url.success" xml:space="preserve">
<data name="setup.ruleUrl.success" xml:space="preserve">
<value>Congratulations the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>Questa operazione non è consentita, il tuo account potrebbe essere bloccato.</value>
</data>

48
backend/src/Squidex.Shared/Texts.nl.resx

@ -220,6 +220,9 @@
<data name="common.contributorId" xml:space="preserve">
<value>Bijdrager-ID of e-mailadres</value>
</data>
<data name="common.critical" xml:space="preserve">
<value>Critial</value>
</data>
<data name="common.data" xml:space="preserve">
<value>Gegevens</value>
</data>
@ -421,12 +424,18 @@
<data name="common.signup" xml:space="preserve">
<value>Aanmelden</value>
</data>
<data name="common.success" xml:space="preserve">
<value>Success</value>
</data>
<data name="common.text" xml:space="preserve">
<value>Tekst</value>
</data>
<data name="common.trigger" xml:space="preserve">
<value>Trigger</value>
</data>
<data name="common.warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="common.workflow" xml:space="preserve">
<value>Workflow</value>
</data>
@ -917,16 +926,10 @@
<value>OR</value>
</data>
<data name="setup.headline" xml:space="preserve">
<value>One Time Installation</value>
<value>Installation</value>
</data>
<data name="setup.hint" xml:space="preserve">
<value>You are seeing this screen because no user exists yet. After a user is created you are not able to use this screen again.</value>
</data>
<data name="setup.https.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.https.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
<value>You are seeing this screen because no user exists yet. After a user is created, you are not able to use this screen again.</value>
</data>
<data name="setup.madeBy" xml:space="preserve">
<value>Proudly made by</value>
@ -934,15 +937,36 @@
<data name="setup.madeByCopyright" xml:space="preserve">
<value>Sebastian Stehle and Contributors, 2016-2021</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
<data name="setup.ruleAppCreation.warningAdmins" xml:space="preserve">
<value>With your setup, only admins can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=false&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.ruleAppCreation.warningAll" xml:space="preserve">
<value>With your setup, every user can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=true&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.url.failure" xml:space="preserve">
<data name="setup.ruleFolder.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;folder asset store&lt;/strong&gt; where all assets are stored in the file system. Please remember to include the asset folder into your backup strategy and map it to a volume, if you are using Docker.</value>
</data>
<data name="setup.ruleFtp.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;FTP asset store&lt;/strong&gt;. It is not recommended to use this storage type because of bad performance.</value>
</data>
<data name="setup.ruleHttps.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.ruleHttps.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
</data>
<data name="setup.rules.headline" xml:space="preserve">
<value>System Checklist</value>
</data>
<data name="setup.ruleUrl.failure" xml:space="preserve">
<value>You should access Squidex only over one one canonical URL and configure this URL over the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value>
</data>
<data name="setup.url.success" xml:space="preserve">
<data name="setup.ruleUrl.success" xml:space="preserve">
<value>Congratulations the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>Deze bewerking is niet toegestaan, je account is mogelijk vergrendeld.</value>
</data>

48
backend/src/Squidex.Shared/Texts.resx

@ -220,6 +220,9 @@
<data name="common.contributorId" xml:space="preserve">
<value>Contributor ID or email</value>
</data>
<data name="common.critical" xml:space="preserve">
<value>Critial</value>
</data>
<data name="common.data" xml:space="preserve">
<value>Data</value>
</data>
@ -421,12 +424,18 @@
<data name="common.signup" xml:space="preserve">
<value>Signup</value>
</data>
<data name="common.success" xml:space="preserve">
<value>Success</value>
</data>
<data name="common.text" xml:space="preserve">
<value>Text</value>
</data>
<data name="common.trigger" xml:space="preserve">
<value>Trigger</value>
</data>
<data name="common.warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="common.workflow" xml:space="preserve">
<value>Workflow</value>
</data>
@ -917,16 +926,10 @@
<value>OR</value>
</data>
<data name="setup.headline" xml:space="preserve">
<value>One Time Installation</value>
<value>Installation</value>
</data>
<data name="setup.hint" xml:space="preserve">
<value>You are seeing this screen because no user exists yet. After a user is created you are not able to use this screen again.</value>
</data>
<data name="setup.https.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.https.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
<value>You are seeing this screen because no user exists yet. After a user is created, you are not able to use this screen again.</value>
</data>
<data name="setup.madeBy" xml:space="preserve">
<value>Proudly made by</value>
@ -934,15 +937,36 @@
<data name="setup.madeByCopyright" xml:space="preserve">
<value>Sebastian Stehle and Contributors, 2016-2021</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
<data name="setup.ruleAppCreation.warningAdmins" xml:space="preserve">
<value>With your setup, only admins can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=false&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.ruleAppCreation.warningAll" xml:space="preserve">
<value>With your setup, every user can create new apps. If you want to change this set &lt;code&gt;UI__ONLYADMINCANCREATEAPPS=true&lt;/code&gt; as environment variable.</value>
</data>
<data name="setup.url.failure" xml:space="preserve">
<data name="setup.ruleFolder.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;folder asset store&lt;/strong&gt; where all assets are stored in the file system. Please remember to include the asset folder into your backup strategy and map it to a volume, if you are using Docker.</value>
</data>
<data name="setup.ruleFtp.warning" xml:space="preserve">
<value>You are using the &lt;strong&gt;FTP asset store&lt;/strong&gt;. It is not recommended to use this storage type because of bad performance.</value>
</data>
<data name="setup.ruleHttps.failure" xml:space="preserve">
<value> You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the &lt;code&gt;X-Forwarded-*&lt;/code&gt; headers.</value>
</data>
<data name="setup.ruleHttps.success" xml:space="preserve">
<value>Congratulations, you are accessing your Squidex installation over a secure connection (https).</value>
</data>
<data name="setup.rules.headline" xml:space="preserve">
<value>System Checklist</value>
</data>
<data name="setup.ruleUrl.failure" xml:space="preserve">
<value>You should access Squidex only over one one canonical URL and configure this URL over the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value>
</data>
<data name="setup.url.success" xml:space="preserve">
<data name="setup.ruleUrl.success" xml:space="preserve">
<value>Congratulations the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value>
</data>
<data name="setup.title" xml:space="preserve">
<value>Installation</value>
</data>
<data name="users.accessDenied.text" xml:space="preserve">
<value>This operation is not allowed, your account might be locked.</value>
</data>

1
backend/src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs

@ -230,7 +230,6 @@ namespace Squidex.Areas.IdentityServer.Controllers.Account
IsFailed = isFailed,
IsLogin = isLogin,
HasPasswordAuth = allowPasswordAuth,
HasPasswordAndExternal = allowPasswordAuth && externalProviders.Any(),
ReturnUrl = returnUrl
};

3
backend/src/Squidex/Areas/IdentityServer/Controllers/Account/LoginVM.cs

@ -6,6 +6,7 @@
// ==========================================================================
using System.Collections.Generic;
using System.Linq;
namespace Squidex.Areas.IdentityServer.Controllers.Account
{
@ -19,7 +20,7 @@ namespace Squidex.Areas.IdentityServer.Controllers.Account
public bool HasPasswordAuth { get; set; }
public bool HasPasswordAndExternal { get; set; }
public bool HasExternalLogin => ExternalProviders.Any();
public IReadOnlyList<ExternalProvider> ExternalProviders { get; set; }
}

17
backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs

@ -12,6 +12,8 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Squidex.Areas.Api.Controllers.UI;
using Squidex.Assets;
using Squidex.Config;
using Squidex.Domain.Users;
using Squidex.Hosting;
@ -22,20 +24,26 @@ using Squidex.Infrastructure.Validation;
namespace Squidex.Areas.IdentityServer.Controllers.Setup
{
[AllowAnonymous]
public class SetupController : IdentityServerController
{
private readonly IAssetStore assetStore;
private readonly IUrlGenerator urlGenerator;
private readonly IUserService userService;
private readonly MyUIOptions uiOptions;
private readonly MyIdentityOptions identityOptions;
public SetupController(IOptions<MyIdentityOptions> identityOptions,
public SetupController(
IAssetStore assetStore,
IOptions<MyUIOptions> uiOptions,
IOptions<MyIdentityOptions> identityOptions,
IUrlGenerator urlGenerator,
IUserService userService)
{
this.assetStore = assetStore;
this.identityOptions = identityOptions.Value;
this.uiOptions = uiOptions.Value;
this.urlGenerator = urlGenerator;
this.userService = userService;
this.identityOptions = identityOptions.Value;
}
[HttpGet]
@ -99,7 +107,10 @@ namespace Squidex.Areas.IdentityServer.Controllers.Setup
BaseUrlConfigured = urlGenerator.BuildUrl(),
BaseUrlCurrent = $"{request.Scheme}://{request.Host}",
ErrorMessage = errorMessage,
EverybodyCanCreateApps = !uiOptions.OnlyAdminsCanCreateApps,
IsValidHttps = HttpContext.Request.IsHttps,
IsAssetStoreFile = assetStore is FolderAssetStore,
IsAssetStoreFtp = assetStore is FTPAssetStore,
HasExternalLogin = externalProviders.Any(),
HasPasswordAuth = identityOptions.AllowPasswordAuth,
};

8
backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupVM.cs

@ -19,10 +19,14 @@ namespace Squidex.Areas.IdentityServer.Controllers.Setup
public bool IsValidHttps { get; set; }
public bool IsAssetStoreFtp { get; set; }
public bool IsAssetStoreFile { get; set; }
public bool EverybodyCanCreateApps { get; set; }
public bool HasExternalLogin { get; set; }
public bool HasPasswordAuth { get; set; }
public bool HasPasswordAndExternal { get; set; }
}
}

48
backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml

@ -8,7 +8,7 @@
ViewBag.Title = action;
}
<div class="container">
<div class="row text-center">
<div class="btn-group profile-headline">
@ -45,7 +45,7 @@
}
</form>
@if (Model.HasPasswordAndExternal)
@if (Model.HasExternalLogin && Model.HasPasswordAuth)
{
<div class="profile-separator">
<div class="profile-separator-text">@T.Get("users.login.separator")</div>
@ -54,36 +54,36 @@
@if (Model.HasPasswordAuth)
{
if (Model.IsLogin)
if (Model.IsLogin)
{
if (Model.IsFailed)
{
if (Model.IsFailed)
{
<div class="form-alert form-alert-error">@T.Get("users.login.error")</div>
}
<div class="form-alert form-alert-error">@T.Get("users.login.error")</div>
}
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@Model.ReturnUrl" method="post">
<div class="form-group">
<input type="email" class="form-control" name="email" id="email" placeholder="@T.Get("users.login.emailPlaceholder")" />
</div>
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@Model.ReturnUrl" method="post">
<div class="form-group">
<input type="email" class="form-control" name="email" id="email" placeholder="@T.Get("users.login.emailPlaceholder")" />
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" id="password" placeholder="@T.Get("users.login.passwordPlaceholder")" />
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" id="password" placeholder="@T.Get("users.login.passwordPlaceholder")" />
</div>
<button type="submit" class="btn btn-block btn-primary">@action</button>
</form>
}
else
{
<div class="profile-password-signup text-center">@T.Get("users.login.askAdmin")</div>
}
<button type="submit" class="btn btn-block btn-primary">@action</button>
</form>
}
else
{
<div class="profile-password-signup text-center">@T.Get("users.login.askAdmin")</div>
}
}
@if (Model.IsLogin)
{
<p class="profile-footer">
@T.Get("users.login.noAccountSignupQuestion")
@T.Get("users.login.noAccountSignupQuestion")
<a asp-controller="Account" asp-action="Signup" asp-route-returnurl="@Model.ReturnUrl">
@T.Get("users.login.noAccountSignupAction")
</a>
@ -93,7 +93,7 @@ else
{
<p class="profile-footer">
@T.Get("users.login.noAccountLoginQuestion")
<a asp-controller="Account" asp-action="Login" asp-route-returnurl="@Model.ReturnUrl">
@T.Get("users.login.noAccountLoginAction")
</a>

140
backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml

@ -15,6 +15,57 @@
</div>
}
}
void RenderRuleAsSuccess(string message)
{
<div class="row mt-4">
<div class="col-auto">
<div class="status-icon status-icon-success mt-2">
<i class="icon-checkmark"></i>
</div>
</div>
<div class="col">
<div>
@Html.Raw(message)
</div>
</div>
</div>
}
void RenderRuleAsCritical(string message)
{
<div class="row mt-4">
<div class="col-auto">
<div class="status-icon status-icon-failed mt-2">
<i class="icon-exclamation"></i>
</div>
</div>
<div class="col">
<div>
<strong>@T.Get("common.critical")</strong>: @Html.Raw(message)
</div>
</div>
</div>
}
void RenderRuleAsWarning(string message)
{
<div class="row mt-4">
<div class="col-auto">
<div class="status-icon status-icon-warning mt-2">
<i class="icon-exclamation"></i>
</div>
</div>
<div class="col">
<div>
<strong>@T.Get("common.warning")</strong>: @Html.Raw(message)
</div>
</div>
</div>
}
}
<div class="card">
@ -26,63 +77,44 @@
<small class="form-text text-muted mt-2 mb-2">@T.Get("setup.hint")</small>
<div class="profile-section">
<h2>System Status</h2>
<div class="row mt-4">
@if (Model.IsValidHttps)
{
<div class="col-auto">
<div class="status-icon status-icon-success mt-1">
<i class="icon-checkmark"></i>
</div>
</div>
<h2>@T.Get("setup.rules.headline")</h2>
<div class="col">
@Html.Raw(T.Get("setup.https.success"))
</div>
}
else
{
<div class="col-auto">
<div class="status-icon status-icon-failed mt-1">
<i class="icon-exclamation"></i>
</div>
</div>
<div class="col">
@Html.Raw(T.Get("setup.https.failure"))
</div>
}
</div>
@if (Model.IsValidHttps)
{
RenderRuleAsSuccess(T.Get("setup.ruleHttps.success"));
}
else
{
RenderRuleAsCritical(T.Get("setup.ruleHttps.failure"));
}
<div class="row mt-4">
@if (Model.BaseUrlConfigured == Model.BaseUrlCurrent)
{
<div class="col-auto">
<div class="status-icon status-icon-success mt-1">
<i class="icon-checkmark"></i>
</div>
</div>
@if (Model.BaseUrlConfigured == Model.BaseUrlCurrent)
{
RenderRuleAsSuccess(T.Get("setup.ruleUrl.success"));
}
else
{
RenderRuleAsCritical(T.Get("setup.ruleUrl.failure", new { actual = Model.BaseUrlCurrent, configured = Model.BaseUrlConfigured }));
}
<div class="col">
@Html.Raw(T.Get("setup.url.success"))
</div>
}
else
{
<div class="col-auto">
<div class="status-icon status-icon-failed mt-1">
<i class="icon-exclamation"></i>
</div>
@if (Model.EverybodyCanCreateApps)
{
RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAdmins"));
}
else
{
RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAll"));
}
</div>
@if (Model.IsAssetStoreFtp)
{
RenderRuleAsWarning(T.Get("setup.ruleFtp.warning"));
}
<div class="col">
@Html.Raw(T.Get("setup.url.failure", new { actual = Model.BaseUrlCurrent, configured = Model.BaseUrlConfigured }))
</div>
}
</div>
@if (Model.IsAssetStoreFile)
{
RenderRuleAsWarning(T.Get("setup.ruleFolder.warning"));
}
</div>
<hr />
@ -110,7 +142,7 @@
</div>
}
@if (Model.HasExternalLogin)
@if (Model.HasPasswordAuth)
{
<h3>@T.Get("setup.createUser.headlineCreate")</h3>
@ -166,4 +198,4 @@
<small class="text-muted">
@T.Get("setup.madeBy")<br />@T.Get("setup.madeByCopyright")
</small>
</div>
</div>

35
backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs

@ -24,7 +24,6 @@ namespace Squidex.Web.Pipeline
private readonly IHttpResponseFeature responseFeature = A.Fake<IHttpResponseFeature>();
private readonly HttpContext httpContext = new DefaultHttpContext();
private readonly RequestDelegate next;
private readonly RequestExceptionMiddleware sut;
private bool isNextCalled;
public RequestExceptionMiddlewareTests()
@ -37,8 +36,6 @@ namespace Squidex.Web.Pipeline
};
httpContext.Features.Set(responseFeature);
sut = new RequestExceptionMiddleware(resultWriter, log);
}
[Fact]
@ -46,7 +43,9 @@ namespace Squidex.Web.Pipeline
{
httpContext.Request.QueryString = new QueryString("?error=412");
await sut.InvokeAsync(httpContext, next);
var sut = new RequestExceptionMiddleware(next);
await sut.InvokeAsync(httpContext, resultWriter, log);
Assert.False(isNextCalled);
@ -60,7 +59,9 @@ namespace Squidex.Web.Pipeline
{
httpContext.Request.QueryString = new QueryString("?error=hello");
await sut.InvokeAsync(httpContext, next);
var sut = new RequestExceptionMiddleware(next);
await sut.InvokeAsync(httpContext, resultWriter, log);
Assert.True(isNextCalled);
@ -73,7 +74,9 @@ namespace Squidex.Web.Pipeline
{
httpContext.Request.QueryString = new QueryString("?error=99");
await sut.InvokeAsync(httpContext, next);
var sut = new RequestExceptionMiddleware(next);
await sut.InvokeAsync(httpContext, resultWriter, log);
Assert.True(isNextCalled);
@ -89,7 +92,9 @@ namespace Squidex.Web.Pipeline
throw new InvalidOperationException();
});
await sut.InvokeAsync(httpContext, failingNext);
var sut = new RequestExceptionMiddleware(failingNext);
await sut.InvokeAsync(httpContext, resultWriter, log);
A.CallTo(() => resultWriter.ExecuteAsync(A<ActionContext>._,
A<ObjectResult>.That.Matches(x => x.StatusCode == 500 && x.Value is ErrorDto)))
@ -106,7 +111,9 @@ namespace Squidex.Web.Pipeline
throw ex;
});
await sut.InvokeAsync(httpContext, failingNext);
var sut = new RequestExceptionMiddleware(failingNext);
await sut.InvokeAsync(httpContext, resultWriter, log);
A.CallTo(() => log.Log(SemanticLogLevel.Error, ex, A<LogFormatter>._))
.MustHaveHappened();
@ -123,7 +130,9 @@ namespace Squidex.Web.Pipeline
throw new InvalidOperationException();
});
await sut.InvokeAsync(httpContext, failingNext);
var sut = new RequestExceptionMiddleware(failingNext);
await sut.InvokeAsync(httpContext, resultWriter, log);
A.CallTo(() => resultWriter.ExecuteAsync(A<ActionContext>._, A<ObjectResult>._))
.MustNotHaveHappened();
@ -139,7 +148,9 @@ namespace Squidex.Web.Pipeline
return Task.CompletedTask;
});
await sut.InvokeAsync(httpContext, failingNext);
var sut = new RequestExceptionMiddleware(failingNext);
await sut.InvokeAsync(httpContext, resultWriter, log);
A.CallTo(() => resultWriter.ExecuteAsync(A<ActionContext>._,
A<ObjectResult>.That.Matches(x => x.StatusCode == 412 && x.Value is ErrorDto)))
@ -159,7 +170,9 @@ namespace Squidex.Web.Pipeline
return Task.CompletedTask;
});
await sut.InvokeAsync(httpContext, failingNext);
var sut = new RequestExceptionMiddleware(failingNext);
await sut.InvokeAsync(httpContext, resultWriter, log);
A.CallTo(() => resultWriter.ExecuteAsync(A<ActionContext>._, A<ObjectResult>._))
.MustNotHaveHappened();

4
frontend/app/theme/_common.scss

@ -239,6 +239,10 @@ body {
color: inherit;
}
&-warning {
background: $color-theme-orange;
}
&-failed {
background: $color-theme-error;
}

Loading…
Cancel
Save