mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 02:23:19 -04:00
Login user after they register
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from flask import render_template, redirect, jsonify
|
from flask import render_template, redirect, jsonify
|
||||||
|
from flask_login import login_user
|
||||||
|
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.main.dao import users_dao
|
from app.main.dao import users_dao
|
||||||
@@ -26,6 +27,7 @@ def process_register():
|
|||||||
role_id=1)
|
role_id=1)
|
||||||
try:
|
try:
|
||||||
users_dao.insert_user(user)
|
users_dao.insert_user(user)
|
||||||
|
login_user(user)
|
||||||
return redirect('/two-factor')
|
return redirect('/two-factor')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify(database_error=e.message), 400
|
return jsonify(database_error=e.message), 400
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def test_should_return_400_if_password_is_blacklisted(notifications_admin, notif
|
|||||||
data={'name': 'Bad Mobile',
|
data={'name': 'Bad Mobile',
|
||||||
'email_address': 'bad_mobile@example.not.right',
|
'email_address': 'bad_mobile@example.not.right',
|
||||||
'mobile_number': '+44123412345',
|
'mobile_number': '+44123412345',
|
||||||
'password': 'password'})
|
'password': 'password1234'})
|
||||||
|
|
||||||
response.status_code == 400
|
response.status_code == 400
|
||||||
assert 'That password is blacklisted, too common' in response.get_data(as_text=True)
|
assert 'That password is blacklisted, too common' in response.get_data(as_text=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user