From c471070162ac9b65ae57db9a3fa49fb14562ce62 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 4 Jul 2024 21:07:39 +0200 Subject: [PATCH] [backend/razor] Add feature flags toggles to /oauth/authorize --- .../Pages/OAuth/Authorize.cshtml | 28 +++++++++++++------ .../Pages/OAuth/Authorize.cshtml.cs | 25 ++++++++++------- .../Pages/OAuth/Authorize.cshtml.css | 8 ++++-- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml index 4969cf87..d543590f 100644 --- a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml +++ b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml @@ -17,15 +17,25 @@ } - Log in below to confirm this: - -
-
- - - -
-
+
+
+ Feature flags: +
+
+ + +
+
+ + +
+
+ Log in below to confirm this: +
+ + + +
} else if (Model.Token.RedirectUri == "urn:ietf:wg:oauth:2.0:oob") diff --git a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs index 5b40da1a..8a6c78c1 100644 --- a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs +++ b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.cs @@ -43,7 +43,10 @@ public class AuthorizeModel(DatabaseContext db) : PageModel throw GracefulException.BadRequest("Cannot request redirect_uri not sent during app registration"); } - public async Task OnPost([FromForm] string username, [FromForm] string password) + public async Task OnPost( + [FromForm] string username, [FromForm] string password, [FromForm] bool supportsHtmlFormatting, + [FromForm] bool autoDetectQuotes + ) { // Validate query parameters first await OnGet(); @@ -60,15 +63,17 @@ public class AuthorizeModel(DatabaseContext db) : PageModel var token = new OauthToken { - Id = IdHelpers.GenerateSlowflakeId(), - Active = false, - Code = CryptographyHelpers.GenerateRandomString(32), - Token = CryptographyHelpers.GenerateRandomString(32), - App = App, - User = user, - CreatedAt = DateTime.UtcNow, - Scopes = Scopes, - RedirectUri = RedirectUri + Id = IdHelpers.GenerateSlowflakeId(), + Active = false, + Code = CryptographyHelpers.GenerateRandomString(32), + Token = CryptographyHelpers.GenerateRandomString(32), + App = App, + User = user, + CreatedAt = DateTime.UtcNow, + Scopes = Scopes, + RedirectUri = RedirectUri, + AutoDetectQuotes = autoDetectQuotes, + SupportsHtmlFormatting = supportsHtmlFormatting }; await db.AddAsync(token); diff --git a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.css b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.css index 80555239..1a12982f 100644 --- a/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.css +++ b/Iceshrimp.Backend/Pages/OAuth/Authorize.cshtml.css @@ -2,6 +2,10 @@ color: #9a92ff; } -.form-wrapper { - padding-top: 5px; +.margin-bottom-5px { + margin-bottom: 5px; +} + +.margin-top-10px { + margin-top: 10px; } \ No newline at end of file