Skip to content

Commit

Permalink
Backport small updates done in master.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Apr 11, 2010
1 parent 6915e62 commit 681f816
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion app/controllers/registrations_controller.rb
Expand Up @@ -14,7 +14,6 @@ def create
build_resource

if resource.save
flash[:"#{resource_name}_signed_up"] = true
set_flash_message :notice, :signed_up
sign_in_and_redirect(resource_name, resource)
else
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/sessions_controller.rb
Expand Up @@ -4,7 +4,7 @@ class SessionsController < ApplicationController

# GET /resource/sign_in
def new
unless resource_just_signed_up?
unless flash[:notice].present?
Devise::FLASH_MESSAGES.each do |message|
set_now_flash_message :alert, message if params.try(:[], message) == "true"
end
Expand Down Expand Up @@ -36,10 +36,6 @@ def destroy

protected

def resource_just_signed_up?
flash[:"#{resource_name}_signed_up"]
end

def clean_up_passwords(object)
object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/devise/locales/en.yml
Expand Up @@ -21,7 +21,7 @@ en:
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
link: 'Sign up'
signed_up: 'You have signed up successfully.'
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent your e-mail.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
unlocks:
Expand Down
5 changes: 3 additions & 2 deletions test/integration/registerable_test.rb
Expand Up @@ -28,8 +28,7 @@ class RegistrationTest < ActionController::IntegrationTest
fill_in 'password confirmation', :with => 'new_user123'
click_button 'Sign up'

assert_equal true, @controller.send(:flash)[:"user_signed_up"]
assert_equal "You have signed up successfully.", @controller.send(:flash)[:notice]
assert_equal "You have signed up successfully. If enabled, a confirmation was sent your e-mail.", @controller.send(:flash)[:notice]

# For some reason flash is not being set correctly, so instead of getting the
# "signed_up" message we get the unconfirmed one. Seems to be an issue with
Expand All @@ -38,6 +37,8 @@ class RegistrationTest < ActionController::IntegrationTest
# assert_contain 'You have signed up successfully.'
# assert_not_contain 'confirm your account'

follow_redirect!
assert_contain 'Sign in'
assert_not warden.authenticated?(:user)

user = User.last
Expand Down

0 comments on commit 681f816

Please sign in to comment.