mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 08:30: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
|
||||
|
||||
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():
|
||||
user = flask.g.user
|
||||
new_email = form.email.data
|
||||
|
@ -472,7 +481,7 @@ def profile():
|
|||
|
||||
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>')
|
||||
|
|
|
@ -5,12 +5,16 @@
|
|||
|
||||
{% if g.user %}
|
||||
<h1>My Account</h1>
|
||||
<div class="content">
|
||||
<p>ID: {{g.user.id}}</p>
|
||||
<p>Account created on: {{g.user.created_time}}</p>
|
||||
<p>Email address: {{g.user.email}}</p>
|
||||
<p>User class: {{level}}</p>
|
||||
</div>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>User ID:</dt>
|
||||
<dd>{{g.user.id}}</dd>
|
||||
<dt>Account created on:</dt>
|
||||
<dd>{{g.user.created_time}}</dd>
|
||||
<dt>Email address:</dt>
|
||||
<dd>{{g.user.email}}</dd>
|
||||
<dt>User class:</dt>
|
||||
<dd>{{level}}</dd><br>
|
||||
</dl>
|
||||
{% endif %}
|
||||
|
||||
<h2>Edit Profile</h2>
|
||||
|
|
|
@ -4,27 +4,34 @@
|
|||
{% from "_formhelpers.html" import render_field %}
|
||||
|
||||
{% if superadmin %}
|
||||
<h1>User Information</h1>
|
||||
<p>ID: {{user.id}}</p>
|
||||
<p>Account created on: {{user.created_time}}</p>
|
||||
<p>Email address: {{user.email}}</p>
|
||||
<p>User class: {{level}}</p>
|
||||
<form method="POST">
|
||||
{{ form.csrf_token }}
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
{{ render_field(form.user_class, class_='form-control')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<input type="submit" value="Apply" class="btn btn-primary">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<h2>User Information</h2><br>
|
||||
<dl class="dl-horizontal">
|
||||
<dt>User ID:</dt>
|
||||
<dd>{{user.id}}</dd>
|
||||
<dt>Account created on:</dt>
|
||||
<dd>{{user.created_time}}</dd>
|
||||
<dt>Email address:</dt>
|
||||
<dd>{{user.email}}</dd>
|
||||
<dt>User class:</dt>
|
||||
<dd>{{level}}</dd><br>
|
||||
</dl>
|
||||
<form method="POST">
|
||||
{{ form.csrf_token }}
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
{{ render_field(form.user_class, class_='form-control')}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary">Apply</button>
|
||||
</div>
|
||||
</form>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<h3>
|
||||
Browsing {{user.username}}'s torrents
|
||||
Browsing {{user.username}}'s torrents
|
||||
</h3>
|
||||
|
||||
{% include "search_results.html" %}
|
||||
|
|
Loading…
Reference in a new issue