Setup of working user registration. Still a bit crude and needs proper authentication and checks against user account abuse.
This commit is contained in:
parent
40f792f3be
commit
6d125b7a52
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body_content %}
|
||||||
|
|
||||||
|
<h1>Registration Complete</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Thanks for registering {{ username }}. You should be getting an email at {{ email }}
|
||||||
|
that will allow you to activate your account and use rookeri.es .
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -28,6 +28,7 @@ from flask import Flask, abort, flash, render_template, redirect, request, safe_
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
|
import datetime
|
||||||
from rookeries.core.config import Config
|
from rookeries.core.config import Config
|
||||||
from rookeries.core.database import db_session
|
from rookeries.core.database import db_session
|
||||||
from rookeries.core.models import User
|
from rookeries.core.models import User
|
||||||
|
@ -160,15 +161,18 @@ def register_user():
|
||||||
email = request.form["email"]
|
email = request.form["email"]
|
||||||
|
|
||||||
# TODO Add in validation of email... and status that requires email validation of user.
|
# TODO Add in validation of email... and status that requires email validation of user.
|
||||||
user = User(username=username, user_full_name=user_full_name, email=email)
|
user = User(username=username, full_name=user_full_name, email=email)
|
||||||
|
user.security_update_date = datetime.datetime.now()
|
||||||
hashed_password = generate_user_security_hash(user, password, Config.SITE_SECRET)
|
hashed_password = generate_user_security_hash(user, password, Config.SITE_SECRET)
|
||||||
user.password = hashed_password
|
user.password = hashed_password
|
||||||
|
# TODO Fix user types... not working very well at the moment... as in not at all.
|
||||||
|
# user.user_type = UserType.id
|
||||||
|
|
||||||
db_session.add(user)
|
db_session.add(user)
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
|
|
||||||
# TODO Make something a bit nicer.
|
# TODO Make something a bit nicer.
|
||||||
return render_template("user_profile.html", navigation=nav_map, registration=False)
|
return render_template("user_registered.html", navigation=nav_map, username=username, email=email)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return render_template("user_profile.html", navigation=nav_map, registration=True)
|
return render_template("user_profile.html", navigation=nav_map, registration=True)
|
||||||
|
|
Loading…
Reference in New Issue