Add actual create-account action.
This commit is contained in:
parent
a421e25344
commit
32b2455070
|
@ -96,10 +96,22 @@ def index_get():
|
|||
|
||||
|
||||
@writing_blueprint.route('/create_account', methods=['GET'])
|
||||
def create_account():
|
||||
def create_account_page():
|
||||
return render_template('create_account.jinja2')
|
||||
|
||||
|
||||
@writing_blueprint.route('/create_account', methods=['POST'])
|
||||
def create_account():
|
||||
email = request.form['login']
|
||||
user = db.get_user(email)
|
||||
if user:
|
||||
return make_response("A user with that email already exists!", 401)
|
||||
# TODO: Validate email address
|
||||
db.add_user(email, request.form['password'])
|
||||
session['username'] = email
|
||||
return redirect('/')
|
||||
|
||||
|
||||
@writing_blueprint.route('/dbtest', methods=['GET'])
|
||||
def db_test_get():
|
||||
response = make_response(db.get_user_letters(1)[0].contents, 200)
|
||||
|
|
Loading…
Reference in New Issue