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/',
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,
## 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(