chore(webui): rewrite the web session code again while preparing for csrf tokens
#60
This commit is contained in:
parent
3bb5e735c6
commit
895615ad6e
20 changed files with 162 additions and 149 deletions
|
@ -7,7 +7,7 @@
|
|||
Use this page to inspect user accounts.
|
||||
</p>
|
||||
</div>
|
||||
{{ if .Page.IsAdmin }}
|
||||
{{ if .Page.Session.Data.Account.IsAdmin }}
|
||||
<form action="/accounts" enctype="multipart/form-data" method="post">
|
||||
<fieldset>
|
||||
<legend>New User Account</legend>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{{ if .Account.IsAdmin }}
|
||||
<p>This accounts has <strong>admin</strong> privileges on TfStated.</p>
|
||||
{{ end }}
|
||||
{{ if .Page.IsAdmin }}
|
||||
{{ if .Page.Session.Data.Account.IsAdmin }}
|
||||
<h2>Operations</h2>
|
||||
<form action="/accounts/{{ .Account.Id }}" enctype="multipart/form-data" method="post">
|
||||
<div class="flex-row">
|
||||
|
@ -39,7 +39,7 @@
|
|||
value="{{ .Username }}">
|
||||
<label for="is-admin">Is Admin</label>
|
||||
<input {{ if .Account.IsAdmin }}checked{{ end }}
|
||||
{{ if eq .Page.AccountId.String .Account.Id.String }}disabled{{ end }}
|
||||
{{ if eq .Page.Session.Data.Account.Id.String .Account.Id.String }}disabled{{ end }}
|
||||
id="is-admin"
|
||||
name="is-admin"
|
||||
type="checkbox"
|
||||
|
@ -63,13 +63,13 @@
|
|||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Danger Zone</legend>
|
||||
<button {{ if eq .Page.AccountId.String .Account.Id.String }}disabled{{ end }}
|
||||
<button {{ if eq .Page.Session.Data.Account.Id.String .Account.Id.String }}disabled{{ end }}
|
||||
type="submit"
|
||||
value="delete">
|
||||
Delete User Account
|
||||
</button>
|
||||
<!--<button type="submit" value="lock">Lock User Account</button>-->
|
||||
<button {{ if or (ne .Account.PasswordReset nil) (eq .Page.AccountId.String .Account.Id.String) }}disabled{{ end }}
|
||||
<button {{ if or (ne .Account.PasswordReset nil) (eq .Page.Session.Data.Account.Id.String .Account.Id.String) }}disabled{{ end }}
|
||||
type="submit"
|
||||
value="reset-password">
|
||||
Reset Password
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
|
||||
<title>TFSTATED - {{ .Page.Title }}</title>
|
||||
</head>
|
||||
<body class="{{ if .Page.LightMode }}light-theme{{ else }}black-theme{{ end }}">
|
||||
<body class="{{ if .Page.Session.Data.Settings.LightMode }}light-theme{{ else }}black-theme{{ end }}">
|
||||
<header>
|
||||
<h6>TFSTATED</h6>
|
||||
</header>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<legend>Account Settings</legend>
|
||||
<div style="align-items:center; display:grid; grid-template-columns:1fr 1fr;">
|
||||
<label for="dark-mode">Dark mode</label>
|
||||
<input {{ if not .Settings.LightMode }}checked{{ end }}
|
||||
<input {{ if not .Page.Session.Data.Settings.LightMode }}checked{{ end }}
|
||||
id="dark-mode"
|
||||
name="dark-mode"
|
||||
type="checkbox"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue