Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten all authentication helpers #1719

Merged
merged 1 commit into from
Jun 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create
# Call devise reset function.
user.send(:generate_reset_password_token!)
UserMailer.reset_notification(user, request).deliver
redirect_to refinery.new_refinery_user_session_path,
redirect_to refinery.login_path,
:notice => t('email_reset_sent', :scope => 'refinery.users.forgot')
else
flash.now[:error] = if (email = params[:refinery_user][:email]).blank?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def redirect?
if refinery_user?
redirect_to refinery.admin_users_path
elsif refinery_users_exist?
redirect_to refinery.new_refinery_user_session_path
redirect_to refinery.login_path
end
end

Expand Down
2 changes: 1 addition & 1 deletion authentication/app/views/refinery/passwords/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<%= render '/refinery/admin/form_actions', :f => f,
:continue_editing => false,
:submit_button_text => t('reset_password', :scope => 'refinery.users.reset'),
:cancel_url => refinery.new_refinery_user_session_path,
:cancel_url => refinery.login_path,
:cancel_title => nil,
:hide_delete => true -%>
<% end -%>
2 changes: 1 addition & 1 deletion authentication/app/views/refinery/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content_for :header, t('there_are_no_users', :scope => 'refinery.welcome') %>

<%= form_for :user, :url => refinery.refinery_user_registration_path do |f| -%>
<%= form_for :user, :url => refinery.signup_path do |f| -%>

<%= render '/refinery/admin/error_messages', :object => @user, :include_object_name => true %>

Expand Down
8 changes: 4 additions & 4 deletions authentication/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

# Override Devise's other routes for convenience methods.
devise_scope :refinery_user do
get '/refinery/login', :to => "sessions#new", :as => :new_refinery_user_session
get '/refinery/logout', :to => "sessions#destroy", :as => :destroy_refinery_user_session
get '/refinery/users/register' => 'users#new', :as => :new_refinery_user_registration
post '/refinery/users/register' => 'users#create', :as => :refinery_user_registration
get '/refinery/login', :to => "sessions#new", :as => :login
get '/refinery/logout', :to => "sessions#destroy", :as => :logout
get '/refinery/users/register' => 'users#new', :as => :signup
post '/refinery/users/register' => 'users#create', :as => :signup
end
rescue RuntimeError => exc
if exc.message =~ /ORM/
Expand Down
2 changes: 1 addition & 1 deletion authentication/spec/requests/refinery/passwords_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Users
let!(:user) { FactoryGirl.create(:refinery_user, :email => "[email protected]") }

it "asks user to specify email address" do
visit refinery.new_refinery_user_session_path
visit refinery.login_path
click_link "I forgot my password"
page.should have_content("Please enter the email address for your account.")
end
Expand Down
2 changes: 1 addition & 1 deletion authentication/spec/requests/refinery/sessions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Refinery
FactoryGirl.create(:refinery_user, :username => "ugisozols",
:password => "123456",
:password_confirmation => "123456")
visit refinery.new_refinery_user_session_path
visit refinery.login_path
end

it "shows login form" do
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/refinery/_site_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</span>

<%= link_to t('.log_out', site_bar_translate_locale_args),
refinery.destroy_refinery_user_session_path, :id => 'logout' %>
refinery.logout_path, :id => 'logout' %>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/lib/refinery/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def presenter_for(model, default=BasePresenter)

def refinery_user_required?
if just_installed? and controller_name != 'users'
redirect_to refinery.new_refinery_user_registration_path
redirect_to refinery.signup_path
end
end

Expand Down