Template reorganization,
floating notifications, user settings - more to come laterdev
parent
22e6b0db9e
commit
1c228fa781
@ -0,0 +1,29 @@
|
||||
from flask import (Blueprint, abort, current_app, flash, redirect,
|
||||
render_template, request, send_from_directory, url_for)
|
||||
from flask_login import current_user, login_required
|
||||
from yadc.forms import ChangePassForm
|
||||
|
||||
bp = Blueprint('user', __name__)
|
||||
|
||||
@bp.route('/<username>')
|
||||
def profile(username):
|
||||
return "OH HELLO, HERETIC!"
|
||||
|
||||
@bp.route('/settings')
|
||||
@login_required
|
||||
def settings():
|
||||
form = ChangePassForm(request.form)
|
||||
if request.method == 'POST' and form.validate():
|
||||
user = current_user
|
||||
|
||||
if not user.check_password(form.password_current.data):
|
||||
flash('Incorrect password')
|
||||
return redirect(url_for('.settings'))
|
||||
|
||||
user.create_password(form.password.data)
|
||||
db.session.commit()
|
||||
|
||||
flash('Password changed successfully.')
|
||||
return redirect(url_for('.settings'))
|
||||
|
||||
return render_template('manage/user.html', form=form)
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
||||
{% block content %}
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
||||
{% block content %}
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
||||
{% block content %}
|
@ -0,0 +1,13 @@
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from '_includes.html' import render_sidenav with context %}
|
||||
|
||||
{% block content %}
|
||||
<div class="important_subwrap">
|
||||
<section class="side_panel">
|
||||
{{ render_sidenav({"speedtest": ("Speedtest", "http://speedtest.cesnet.cz")}) }}
|
||||
</section>
|
||||
<section class="{{ setting_class }}">
|
||||
{% block setting_content %}{% endblock %}
|
||||
</section>
|
||||
</div>
|
||||
{% endblock content %}
|
@ -0,0 +1,24 @@
|
||||
{% extends 'layout/settings.html' %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
||||
{% block setting_content %}
|
||||
<form action="" method="post">
|
||||
<h3>Change password</h3>
|
||||
{{ form.csrf_token }}
|
||||
<div>
|
||||
{{ form.password_current(placeholder="Current password") }}
|
||||
{{ errors(form.password_current) }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.password(placeholder="Password") }}
|
||||
{{ errors(form.password) }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.password_again(placeholder="Repeat password") }}
|
||||
{{ errors(form.password_again) }}
|
||||
</div>
|
||||
<div>
|
||||
{{ form.submit() }}
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from '_includes.html' import render_tags, render_pagination with context %}
|
||||
|
||||
{% block content %}
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from '_includes.html' import render_tags, render_comments, render_post_edit with context %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
{% extends 'layout/base.html' %}
|
||||
{% from "_formhelpers.html" import errors %}
|
||||
|
||||
{% block content %}
|
Loading…
Reference in New Issue