Merge pull request 'feat: refactor user settings' (#4) from weva/matemat:main into main
Reviewed-on: #4
This commit is contained in:
commit
e5870f4d60
1 changed files with 82 additions and 40 deletions
|
@ -24,45 +24,72 @@
|
||||||
<section class="tab-pane fade pt-3 show active" id="settings-account-tab-pane" role="tabpanel">
|
<section class="tab-pane fade pt-3 show active" id="settings-account-tab-pane" role="tabpanel">
|
||||||
<h2>My Account</h2>
|
<h2>My Account</h2>
|
||||||
|
|
||||||
|
<div class="row itemlist">
|
||||||
|
<div class="col-xl-1 col-md-2 col-sm-3 col-4 mb-3">
|
||||||
|
<div class="card text-bg-light">
|
||||||
|
<div class="card-header">{{ authuser.name }}</div>
|
||||||
|
<img class="card-img-bottom" draggable="false" src="/static/upload/thumbnails/users/{{ authuser.id }}.png?cacheBuster={{ now }}" alt="Avatar of {{ authuser.name }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8">
|
<form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8">
|
||||||
<label class="form-label" for="settings-myaccount-username">Username: </label>
|
<div class="row g-2">
|
||||||
<input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}" /><br/>
|
<div class="col-md">
|
||||||
|
<div class="form-floating">
|
||||||
<label class="form-label" for="settings-myaccount-email">E-Mail: </label>
|
<input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}">
|
||||||
<input class="form-control" id="settings-myaccount-email" type="text" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}" /><br/>
|
<label for="settings-myaccount-username">Username</label>
|
||||||
|
</div>
|
||||||
<label class="form-label" for="settings-myaccount-receipt-pref">Receipts: </label>
|
</div>
|
||||||
<select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref">
|
<div class="col-md">
|
||||||
{% for pref in receipt_preference_class %}
|
<div class="form-floating">
|
||||||
<option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected="selected" {% endif %}>{{ pref.human_readable }}</option>
|
<input class="form-control" id="settings-myaccount-email" type="email" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}">
|
||||||
{% endfor %}
|
<label for="settings-myaccount-email">E-Mail</label>
|
||||||
</select>
|
</div>
|
||||||
{% if config_smtp_enabled != '1' %}Sending receipts is disabled by your administrator.{% endif %}
|
</div>
|
||||||
<br/>
|
{% if config_smtp_enabled == '1' %}
|
||||||
|
<div class="col-md">
|
||||||
<div class="form-check">
|
<div class="form-floating">
|
||||||
<input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}/>
|
<select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref">
|
||||||
<label class="form-check-label" for="settings-myaccount-ismember">Member</label>
|
{% for pref in receipt_preference_class %}
|
||||||
|
<option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected {% endif %}>{{ pref.human_readable }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<label for="settings-myaccount-receipt-pref">Receipts</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row g-2">
|
||||||
<div class="form-check">
|
<div class="col">
|
||||||
<input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}/>
|
<div class="form-check">
|
||||||
<label class="form-check-label" for="settings-myaccount-isadmin">Admin</label>
|
<input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}>
|
||||||
|
<label class="form-check-label" for="settings-myaccount-ismember">Member</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}>
|
||||||
|
<label class="form-check-label" for="settings-myaccount-isadmin">Admin</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}>
|
||||||
|
<label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row g-2">
|
||||||
<div class="form-check">
|
<div class="col">
|
||||||
<input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}/>
|
<input class="btn btn-primary" type="submit" value="Save changes">
|
||||||
<label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input class="btn btn-primary" type="submit" value="Save changes" />
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Avatar</h2>
|
<h2>Avatar</h2>
|
||||||
|
|
||||||
<form id="settings-avatar-form" method="post" action="/settings?change=avatar" enctype="multipart/form-data" accept-charset="UTF-8">
|
<form id="settings-avatar-form" method="post" action="/settings?change=avatar" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||||
<img src="/static/upload/thumbnails/users/{{ authuser.id }}.png?cacheBuster={{ now }}" alt="Avatar of {{ authuser.name }}" /><br/>
|
|
||||||
|
|
||||||
<label class="form-label" for="settings-avatar-avatar">Upload new file: </label>
|
<label class="form-label" for="settings-avatar-avatar">Upload new file: </label>
|
||||||
<input class="form-control" id="settings-avatar-avatar" type="file" name="avatar" accept="image/*" /><br/>
|
<input class="form-control" id="settings-avatar-avatar" type="file" name="avatar" accept="image/*" /><br/>
|
||||||
|
|
||||||
|
@ -74,16 +101,31 @@
|
||||||
<h2>Password</h2>
|
<h2>Password</h2>
|
||||||
|
|
||||||
<form id="settings-password-form" method="post" action="/settings?change=password" accept-charset="UTF-8">
|
<form id="settings-password-form" method="post" action="/settings?change=password" accept-charset="UTF-8">
|
||||||
<label class="form-label" for="settings-password-oldpass">Current password: </label>
|
<div class="row g-2 mb-2">
|
||||||
<input class="form-control" id="settings-password-oldpass" type="password" name="oldpass" /><br/>
|
<div class="col-md">
|
||||||
|
<div class="form-floating">
|
||||||
<label class="form-label" for="settings-password-newpass">New password: </label>
|
<input class="form-control" id="settings-password-oldpass" type="password" name="oldpass">
|
||||||
<input class="form-control" id="settings-password-newpass" type="password" name="newpass" /><br/>
|
<label for="settings-password-oldpass">Current password </label>
|
||||||
|
</div>
|
||||||
<label class="form-label" for="settings-password-newpass2">Repeat password: </label>
|
</div>
|
||||||
<input class="form-control" id="settings-password-newpass2" type="password" name="newpass2" /><br/>
|
<div class="col-md">
|
||||||
|
<div class="form-floating">
|
||||||
<input class="btn btn-primary" type="submit" value="Save changes" />
|
<input class="form-control" id="settings-password-newpass" type="password" name="newpass">
|
||||||
|
<label for="settings-password-newpass">New password</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="form-floating">
|
||||||
|
<input class="form-control" id="settings-password-newpass2" type="password" name="newpass2">
|
||||||
|
<label for="settings-password-newpass2">Repeat password</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row g-2">
|
||||||
|
<div class="col">
|
||||||
|
<input class="btn btn-primary" type="submit" value="Save changes">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in a new issue