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