jojo/templates/repo/flags.tmpl
Gusted a4642af51a feat: replace cross origin protection (#9830)
Replace the anti-CSRF token with a [cross origin protection by Go](https://go.dev/doc/go1.25#nethttppkgnethttp) that uses a stateless way of verifying if a request was cross origin or not. This allows is to remove al lot of code and replace it with a few lines of code and we no longer have to hand roll this protection. The new protection uses indicators by the browser itself that indicate if the request is cross-origin, thus we no longer have to take care of ensuring the generated CSRF token is passed back to the server any request by the the browser will have send this indicator.

Resolves forgejo/forgejo#3538

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9830
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-10-29 22:43:22 +01:00

32 lines
1 KiB
Go HTML Template

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository">
{{template "repo/header" .}}
<div class="ui container">
{{template "base/alert" .}}
<div class="user-main-content twelve wide column">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.admin.manage_flags"}}
</h4>
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
<strong>{{ctx.Locale.Tr "repo.admin.enabled_flags"}}</strong>
<div class="ui segment tw-pl-4">
{{range $flag, $checked := .Flags}}
<div class="field">
<div class="ui checkbox{{if $checked}} checked{{end}}">
<input name="flags" type="checkbox" value="{{$flag}}" {{if $checked}}checked{{end}}>
<label>{{$flag}}</label>
</div>
</div>
{{end}}
</div>
<div class="field">
<button class="ui primary button">{{ctx.Locale.Tr "repo.admin.update_flags"}}</button>
</div>
</form>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}