mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 19:00:07 +00:00
Merge pull request #107 from UnKnoWn-Consortium/patch-2
Make profile page more profile
This commit is contained in:
commit
02fa705330
|
@ -462,7 +462,7 @@ def profile():
|
||||||
return flask.redirect('/profile')
|
return flask.redirect('/profile')
|
||||||
user.email = form.email.data
|
user.email = form.email.data
|
||||||
flask.flash(flask.Markup(
|
flask.flash(flask.Markup(
|
||||||
'<strong>Email successfully changed!</strong>'), 'info')
|
'<strong>Email successfully changed!</strong>'), 'success')
|
||||||
if new_password:
|
if new_password:
|
||||||
if form.current_password.data != user.password_hash:
|
if form.current_password.data != user.password_hash:
|
||||||
flask.flash(flask.Markup(
|
flask.flash(flask.Markup(
|
||||||
|
@ -470,7 +470,7 @@ def profile():
|
||||||
return flask.redirect('/profile')
|
return flask.redirect('/profile')
|
||||||
user.password_hash = form.new_password.data
|
user.password_hash = form.new_password.data
|
||||||
flask.flash(flask.Markup(
|
flask.flash(flask.Markup(
|
||||||
'<strong>Password successfully changed!</strong>'), 'info')
|
'<strong>Password successfully changed!</strong>'), 'success')
|
||||||
|
|
||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -478,9 +478,11 @@ def profile():
|
||||||
flask.g.user = user
|
flask.g.user = user
|
||||||
return flask.redirect('/profile')
|
return flask.redirect('/profile')
|
||||||
|
|
||||||
current_email = models.User.by_id(flask.g.user.id).email
|
_user = models.User.by_id(flask.g.user.id)
|
||||||
|
username = _user.username
|
||||||
|
current_email = _user.email
|
||||||
|
|
||||||
return flask.render_template('profile.html', form=form, email=current_email, level=level)
|
return flask.render_template('profile.html', form=form, name=username, email=current_email, level=level)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/user/activate/<payload>')
|
@app.route('/user/activate/<payload>')
|
||||||
|
|
|
@ -3,7 +3,20 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% from "_formhelpers.html" import render_field %}
|
{% from "_formhelpers.html" import render_field %}
|
||||||
|
|
||||||
<h1>Edit Profile</h1>
|
<h2 style="margin-bottom: 20px;">Profile of <strong>{{ name }}</strong></h2>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-4 avatar" style="display: none;">
|
||||||
|
<!-- TO BE IMPLEMENTED -->
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<dl class="row" style="margin: 20px 0 15px 0;">
|
||||||
|
<dt class="col-sm-3">User ID:</dt><dd class="col-sm-9">{{ g.user.id }}</dd>
|
||||||
|
<dt class="col-sm-3">User Class:</dt><dd class="col-sm-9">{{ level }}</dd>
|
||||||
|
<dt class="col-sm-3">User Created on:</dt><dd class="col-sm-9">{{ g.user.created_time }}</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ul class="nav nav-tabs" id="profileTabs" role="tablist">
|
<ul class="nav nav-tabs" id="profileTabs" role="tablist">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
|
@ -12,10 +25,8 @@
|
||||||
<li role="presentation">
|
<li role="presentation">
|
||||||
<a href="#email-change" id="email-change-tab" role="tab" data-toggle="tab" aria-controls="profile" aria-expanded="false">Email</a>
|
<a href="#email-change" id="email-change-tab" role="tab" data-toggle="tab" aria-controls="profile" aria-expanded="false">Email</a>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation">
|
|
||||||
<a href="#general-info" id="general-info-tab" role="tab" data-toggle="tab" aria-controls="profile" aria-expanded="false">My Info</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane fade active in" role="tabpanel" id="password-change" aria-labelledby="password-change-tab">
|
<div class="tab-pane fade active in" role="tabpanel" id="password-change" aria-labelledby="password-change-tab">
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
|
@ -35,7 +46,6 @@
|
||||||
{{ render_field(form.password_confirm, class_='form-control', placeholder='New password (confirm)') }}
|
{{ render_field(form.password_confirm, class_='form-control', placeholder='New password (confirm)') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="submit" value="Update" class="btn btn-primary">
|
<input type="submit" value="Update" class="btn btn-primary">
|
||||||
|
@ -62,7 +72,6 @@
|
||||||
{{ render_field(form.current_password, class_='form-control', placeholder='Current password') }}
|
{{ render_field(form.current_password, class_='form-control', placeholder='Current password') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="submit" value="Update" class="btn btn-primary">
|
<input type="submit" value="Update" class="btn btn-primary">
|
||||||
|
@ -70,16 +79,8 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" role="tabpanel" id="general-info" aria-labelledby="general-info-tab">
|
|
||||||
<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>User class:</dt>
|
|
||||||
<dd>{{level}}</dd><br>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue