mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development
This commit is contained in:
commit
26016458dd
@ -47,7 +47,7 @@ class PasswordResetRequestForm(FlaskForm):
|
|||||||
submit = SubmitField('Reset Password')
|
submit = SubmitField('Reset Password')
|
||||||
|
|
||||||
|
|
||||||
class ChangeProfileForm(FlaskForm):
|
class ChangeAccountForm(FlaskForm):
|
||||||
email = StringField('Email', validators=[Optional(), Length(1, 64),
|
email = StringField('Email', validators=[Optional(), Length(1, 64),
|
||||||
Email()])
|
Email()])
|
||||||
username = StringField('Username', validators=[
|
username = StringField('Username', validators=[
|
||||||
|
@ -2,7 +2,7 @@ from flask import flash, redirect, render_template, request, url_for
|
|||||||
from flask_login import current_user, login_required, login_user, logout_user
|
from flask_login import current_user, login_required, login_user, logout_user
|
||||||
from . import auth
|
from . import auth
|
||||||
from .. import db
|
from .. import db
|
||||||
from .forms import ChangeProfileForm, LoginForm, PasswordResetForm, PasswordResetRequestForm, RegistrationForm
|
from .forms import ChangeAccountForm, LoginForm, PasswordResetForm, PasswordResetRequestForm, RegistrationForm
|
||||||
from ..email import send_email
|
from ..email import send_email
|
||||||
from ..models import User
|
from ..models import User
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ def login():
|
|||||||
if next is None or not next.startswith('/'):
|
if next is None or not next.startswith('/'):
|
||||||
next = url_for('main.index')
|
next = url_for('main.index')
|
||||||
return redirect(next)
|
return redirect(next)
|
||||||
flash('Invalid username or password.')
|
flash('<span class="red-text">Invalid username or password.</span>')
|
||||||
return render_template('auth/login.html.j2', form=form, title='Log in')
|
return render_template('auth/login.html.j2', form=form, title='Log in')
|
||||||
|
|
||||||
|
|
||||||
@ -125,10 +125,10 @@ def password_reset(token):
|
|||||||
title='Password Reset')
|
title='Password Reset')
|
||||||
|
|
||||||
|
|
||||||
@auth.route('/profile', methods=['GET', 'POST'])
|
@auth.route('/account', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def profile():
|
def account():
|
||||||
form = ChangeProfileForm()
|
form = ChangeAccountForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
flash('It is just a test, nothing changed.')
|
flash('It is just a test, nothing changed.')
|
||||||
if form.username.data:
|
if form.username.data:
|
||||||
@ -138,8 +138,10 @@ def profile():
|
|||||||
current_user.email = form.email.data
|
current_user.email = form.email.data
|
||||||
current_user.confirmed = False
|
current_user.confirmed = False
|
||||||
db.session.add(current_user)
|
db.session.add(current_user)
|
||||||
|
resend_confirmation()
|
||||||
|
if form.password.data:
|
||||||
|
current_user.password = form.password.data
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
resend_confirmation()
|
return redirect(url_for('auth.account'))
|
||||||
return redirect(url_for('auth.profile'))
|
return render_template('auth/account.html.j2', form=form,
|
||||||
return render_template('auth/profile.html.j2', form=form,
|
title='Account')
|
||||||
title='Profile')
|
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<div class="card large">
|
<h2>Change account information</h2>
|
||||||
<div class="card-content">
|
<div class="card">
|
||||||
<span class="card-title">Change profile</span>
|
<form method="POST">
|
||||||
<form method="POST">
|
<div class="card-content">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
<div class="input-field ">
|
<div class="input-field ">
|
||||||
<i class="material-icons prefix">email</i>
|
<i class="material-icons prefix">email</i>
|
||||||
{{ form.email(type='email', placeholder=current_user.email) }}
|
{{ form.email(type='email', placeholder=current_user.email) }}
|
||||||
{{ form.email.label }}
|
{{ form.email.label }}
|
||||||
|
<span class="helper-text" data-error="wrong" data-success="right">When changing your e-mail adress you will have to reconfirm it.</span>
|
||||||
{% for error in form.email.errors %}
|
{% for error in form.email.errors %}
|
||||||
<span class="helper-text" style="color:red;">{{ error }}</span>
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -39,11 +40,11 @@
|
|||||||
<span class="helper-text" style="color:red;">{{ error }}</span>
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
</div>
|
||||||
{{ form.submit(class='btn right') }}
|
<div class="card-action right-align">
|
||||||
</div>
|
{{ form.submit(class='btn') }}
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -9,29 +9,34 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<p>Sign in into an exisiting account or register a new one!</p>
|
<p>Sign in into an exisiting account or register a new one!</p>
|
||||||
<br>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
<a class="btn" href="{{url_for('auth.register')}}">Register</a>
|
<a class="btn" href="{{url_for('auth.register')}}">Register</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col s12 m6">
|
<div class="col s12 m6">
|
||||||
<div class="card medium">
|
<div class="card medium">
|
||||||
<div class="card-content">
|
<form method="POST">
|
||||||
<span class="card-title">Log In</span>
|
<div class="card-content">
|
||||||
<form method="POST">
|
<span class="card-title">Log In</span>
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">person</i>
|
<i class="material-icons prefix">person</i>
|
||||||
{{ form.login(class='validate') }}
|
{{ form.login(class='validate') }}
|
||||||
{{ form.login.label }}
|
{{ form.login.label }}
|
||||||
|
{% for error in form.login.errors %}
|
||||||
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">vpn_key</i>
|
<i class="material-icons prefix">vpn_key</i>
|
||||||
{{ form.password(class='validate') }}
|
{{ form.password(class='validate') }}
|
||||||
{{ form.password.label }}
|
{{ form.password.label }}
|
||||||
|
{% for error in form.password.errors %}
|
||||||
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="switch left">
|
<div class="switch left">
|
||||||
<label>
|
<label>
|
||||||
@ -41,11 +46,11 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ url_for('auth.password_reset_request') }}" class="right">Forgot Password?</a>
|
<a href="{{ url_for('auth.password_reset_request') }}" class="right">Forgot Password?</a>
|
||||||
<div class="card-action">
|
</div>
|
||||||
{{ form.submit(class='btn right') }}
|
<div class="card-action">
|
||||||
</div>
|
{{ form.submit(class='btn right') }}
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<div class="card large">
|
<div class="card">
|
||||||
<div class="card-content">
|
<form method="POST">
|
||||||
<span class="card-title">Register</span>
|
<div class="card-content">
|
||||||
<form method="POST">
|
<span class="card-title">Register</span>
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<i class="material-icons prefix">account_circle</i>
|
<i class="material-icons prefix">account_circle</i>
|
||||||
@ -39,11 +39,11 @@
|
|||||||
<span class="helper-text" style="color:red;">{{ error }}</span>
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
</div>
|
||||||
{{ form.submit(class='btn right') }}
|
<div class="card-action right-align">
|
||||||
</div>
|
{{ form.submit(class='btn') }}
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<div class="col s12 m8 offset-m2">
|
<div class="col s12 m8 offset-m2">
|
||||||
<div class="card small">
|
<div class="card">
|
||||||
<div class="card-content">
|
<form method="POST">
|
||||||
<span class="card-title">Reset Your Password</span>
|
<div class="card-content">
|
||||||
<form method="POST">
|
<span class="card-title">Reset Your Password</span>
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
{% if form.email is defined %}
|
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
{{ form.email(class='validate', type='email') }}
|
{{ form.email(class='validate', type='email') }}
|
||||||
{{ form.email.label }}
|
{{ form.email.label }}
|
||||||
|
{% for error in form.email.errors %}
|
||||||
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% if form.password is defined %}
|
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
{{ form.password(class='validate', type='password') }}
|
{{ form.password(class='validate', type='password') }}
|
||||||
{{ form.password.label }}
|
{{ form.password.label }}
|
||||||
@ -21,18 +21,18 @@
|
|||||||
<span class="helper-text" style="color:red;">{{ error }}</span>
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% if form.password2 is defined %}
|
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
{{ form.password2(class='validate', type='password') }}
|
{{ form.password2(class='validate', type='password') }}
|
||||||
{{ form.password2.label }}
|
{{ form.password2.label }}
|
||||||
|
{% for error in form.password2.errors %}
|
||||||
|
<span class="helper-text" style="color:red;">{{ error }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
{{ form.submit(class='btn right') }}
|
{{ form.submit(class='btn right') }}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul id="nav-account-dropdown" class="dropdown-content">
|
<ul id="nav-account-dropdown" class="dropdown-content">
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
<li><a href="{{ url_for('auth.profile') }}"><i class="material-icons">person</i>Profile</a></li>
|
<li><a href="{{ url_for('auth.account') }}"><i class="material-icons">person</i>Account</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="{{ url_for('auth.logout') }}"><i class="material-icons">chevron_left</i>Log out</a></li>
|
<li><a href="{{ url_for('auth.logout') }}"><i class="material-icons">chevron_left</i>Log out</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
Loading…
Reference in New Issue
Block a user