diff options
-rw-r--r-- | mediagoblin/auth/routing.py | 3 | ||||
-rw-r--r-- | mediagoblin/auth/views.py | 25 | ||||
-rw-r--r-- | mediagoblin/tests/test_auth.py | 4 |
3 files changed, 18 insertions, 14 deletions
diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index a50afb48..9547b3ea 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -19,9 +19,6 @@ from routes.route import Route auth_routes = [ Route('mediagoblin.auth.register', '/register/', controller='mediagoblin.auth.views:register'), - Route('mediagoblin.auth.register_success', '/register/success/', - template='mediagoblin/auth/register_success.html', - controller='mediagoblin.views:simple_template_render'), Route('mediagoblin.auth.login', '/login/', controller='mediagoblin.auth.views:login'), Route('mediagoblin.auth.logout', '/logout/', diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 6f3c5165..cf07d668 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -55,16 +55,23 @@ def register(request): else: # Create the user - entry = request.db.User() - entry['username'] = request.POST['username'].lower() - entry['email'] = request.POST['email'] - entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash( + user = request.db.User() + user['username'] = request.POST['username'].lower() + user['email'] = request.POST['email'] + user['pw_hash'] = auth_lib.bcrypt_gen_password_hash( request.POST['password']) - entry.save(validate=True) - - send_verification_email(entry, request) - - return redirect(request, "mediagoblin.auth.register_success") + user.save(validate=True) + + send_verification_email(user, request) + + messages.add_message( + request, + messages.INFO, + ('Registration successful! ' + 'You should get a registration email soon.')) + return redirect( + request, 'mediagoblin.user_pages.user_home', + user=user['username']) return render_to_response( request, diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index ad9dd35b..ccb9a536 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -153,9 +153,9 @@ def test_register_views(test_app): ## Did we redirect to the proper page? Use the right template? assert_equal( urlparse.urlsplit(response.location)[2], - '/auth/register/success/') + '/u/happygirl/') assert util.TEMPLATE_TEST_CONTEXT.has_key( - 'mediagoblin/auth/register_success.html') + 'mediagoblin/user_pages/user.html') ## Make sure user is in place new_user = mg_globals.database.User.find_one( |