Big update, corpus analysis reworked, versioned services, preliminary work for contributions

This commit is contained in:
Patrick Jentsch
2022-02-03 12:39:16 +01:00
parent 0647537192
commit fe938c0ca2
36 changed files with 1552 additions and 431 deletions

View File

@ -60,28 +60,37 @@ def register():
return redirect(url_for('main.dashboard'))
form = RegistrationForm(prefix='registration-form')
if form.validate_on_submit():
user = User(email=form.email.data.lower(),
password=form.password.data,
username=form.username.data)
user = User(
email=form.email.data.lower(),
password=form.password.data,
username=form.username.data
)
db.session.add(user)
db.session.commit()
db.session.flush(objects=[user])
db.session.refresh(user)
try:
os.makedirs(user.path)
except OSError:
current_app.logger.error(
f'Make dir {user.path} led to an OSError!')
db.session.delete(user)
db.session.commit()
user.makedirs()
except OSError as e:
current_app.logger.error(e)
db.session.rollback()
abort(500)
else:
token = user.generate_confirmation_token()
msg = create_message(user.email, 'Confirm Your Account',
'auth/email/confirm', token=token, user=user)
msg = create_message(
user.email,
'Confirm Your Account',
'auth/email/confirm',
token=token,
user=user
)
send(msg)
flash('A confirmation email has been sent to you by email.')
return redirect(url_for('.login'))
return render_template('auth/register.html.j2', form=form,
title='Register')
return render_template(
'auth/register.html.j2',
form=form,
title='Register'
)
@bp.route('/confirm/<token>')