[backend/razor] Add feature flags toggles to /oauth/authorize

This commit is contained in:
Laura Hausmann 2024-07-04 21:07:39 +02:00
parent 4a2ee992c2
commit c471070162
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 40 additions and 21 deletions

View file

@ -17,16 +17,26 @@
}
</ul>
Log in below to confirm this:
<div class="form-wrapper">
<form method="post">
<div class="margin-bottom-5px">
Feature flags:
</div>
<div>
<input type="checkbox" name="supportsHtmlFormatting" id="supportsHtmlFormatting" value="1"/>
<label for="supportsHtmlFormatting">This app supports HTML formatting</label>
</div>
<div>
<input type="checkbox" name="autoDetectQuotes" id="autoDetectQuotes" value="1"/>
<label for="autoDetectQuotes">Automatically detect quotes</label>
</div>
<div class="margin-bottom-5px margin-top-10px">
Log in below to confirm this:
</div>
<input type="text" placeholder="Username" name="username"/>
<input type="password" placeholder="Password" name="password"/>
<button type="submit">Submit</button>
</form>
</div>
</div>
}
else if (Model.Token.RedirectUri == "urn:ietf:wg:oauth:2.0:oob")
{

View file

@ -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();
@ -68,7 +71,9 @@ public class AuthorizeModel(DatabaseContext db) : PageModel
User = user,
CreatedAt = DateTime.UtcNow,
Scopes = Scopes,
RedirectUri = RedirectUri
RedirectUri = RedirectUri,
AutoDetectQuotes = autoDetectQuotes,
SupportsHtmlFormatting = supportsHtmlFormatting
};
await db.AddAsync(token);

View file

@ -2,6 +2,10 @@
color: #9a92ff;
}
.form-wrapper {
padding-top: 5px;
.margin-bottom-5px {
margin-bottom: 5px;
}
.margin-top-10px {
margin-top: 10px;
}