mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:10:00 +00:00
styled user info better, show user class on profile
This commit is contained in:
parent
eb59116429
commit
8a87ca93a5
|
@ -452,6 +452,15 @@ def profile():
|
||||||
return flask.redirect('/') # so we dont get stuck in infinite loop when signing out
|
return flask.redirect('/') # so we dont get stuck in infinite loop when signing out
|
||||||
|
|
||||||
form = forms.ProfileForm(flask.request.form)
|
form = forms.ProfileForm(flask.request.form)
|
||||||
|
|
||||||
|
level = 'Regular'
|
||||||
|
if flask.g.user.is_admin:
|
||||||
|
level = 'Moderator'
|
||||||
|
if flask.g.user.is_superadmin: # check this second because we can be admin AND superadmin
|
||||||
|
level = 'Administrator'
|
||||||
|
elif flask.g.user.is_trusted:
|
||||||
|
level = 'Trusted'
|
||||||
|
|
||||||
if flask.request.method == 'POST' and form.validate():
|
if flask.request.method == 'POST' and form.validate():
|
||||||
user = flask.g.user
|
user = flask.g.user
|
||||||
new_email = form.email.data
|
new_email = form.email.data
|
||||||
|
@ -472,7 +481,7 @@ def profile():
|
||||||
|
|
||||||
flask.g.user = user
|
flask.g.user = user
|
||||||
|
|
||||||
return flask.render_template('profile.html', form=form)
|
return flask.render_template('profile.html', form=form, level=level)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/user/activate/<payload>')
|
@app.route('/user/activate/<payload>')
|
||||||
|
|
|
@ -5,12 +5,16 @@
|
||||||
|
|
||||||
{% if g.user %}
|
{% if g.user %}
|
||||||
<h1>My Account</h1>
|
<h1>My Account</h1>
|
||||||
<div class="content">
|
<dl class="dl-horizontal">
|
||||||
<p>ID: {{g.user.id}}</p>
|
<dt>User ID:</dt>
|
||||||
<p>Account created on: {{g.user.created_time}}</p>
|
<dd>{{g.user.id}}</dd>
|
||||||
<p>Email address: {{g.user.email}}</p>
|
<dt>Account created on:</dt>
|
||||||
<p>User class: {{level}}</p>
|
<dd>{{g.user.created_time}}</dd>
|
||||||
</div>
|
<dt>Email address:</dt>
|
||||||
|
<dd>{{g.user.email}}</dd>
|
||||||
|
<dt>User class:</dt>
|
||||||
|
<dd>{{level}}</dd><br>
|
||||||
|
</dl>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2>Edit Profile</h2>
|
<h2>Edit Profile</h2>
|
||||||
|
|
|
@ -4,27 +4,34 @@
|
||||||
{% from "_formhelpers.html" import render_field %}
|
{% from "_formhelpers.html" import render_field %}
|
||||||
|
|
||||||
{% if superadmin %}
|
{% if superadmin %}
|
||||||
<h1>User Information</h1>
|
<h2>User Information</h2><br>
|
||||||
<p>ID: {{user.id}}</p>
|
<dl class="dl-horizontal">
|
||||||
<p>Account created on: {{user.created_time}}</p>
|
<dt>User ID:</dt>
|
||||||
<p>Email address: {{user.email}}</p>
|
<dd>{{user.id}}</dd>
|
||||||
<p>User class: {{level}}</p>
|
<dt>Account created on:</dt>
|
||||||
<form method="POST">
|
<dd>{{user.created_time}}</dd>
|
||||||
{{ form.csrf_token }}
|
<dt>Email address:</dt>
|
||||||
<div class="row">
|
<dd>{{user.email}}</dd>
|
||||||
<div class="form-group col-md-6">
|
<dt>User class:</dt>
|
||||||
{{ render_field(form.user_class, class_='form-control')}}
|
<dd>{{level}}</dd><br>
|
||||||
</div>
|
</dl>
|
||||||
</div>
|
<form method="POST">
|
||||||
<div class="row">
|
{{ form.csrf_token }}
|
||||||
<div class="form-group col-md-6">
|
|
||||||
<input type="submit" value="Apply" class="btn btn-primary">
|
<div class="form-group row">
|
||||||
</div>
|
<div class="col-md-6">
|
||||||
</div>
|
{{ render_field(form.user_class, class_='form-control')}}
|
||||||
</form>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-primary">Apply</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
Browsing {{user.username}}'s torrents
|
Browsing {{user.username}}'s torrents
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{% include "search_results.html" %}
|
{% include "search_results.html" %}
|
||||||
|
|
Loading…
Reference in a new issue