fixed registration and login problems (routing)

This commit is contained in:
Thomas Buchöster
2011-06-30 07:49:18 +02:00
parent 7d9bad30ab
commit b3aff2c42b
5 changed files with 10 additions and 9 deletions
@@ -16,15 +16,15 @@ class DeviseAuth::RegistrationsController < Devise::RegistrationsController
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_in(resource_name, resource)
redirect_to user_path(resource)
async_redirect_to user_path(resource)
else
set_flash_message :notice, :inactive_signed_up, :reason => resource.inactive_message.to_s if is_navigational_format?
expire_session_data_after_sign_in!
redirect_to user_path(resource)
async_redirect_to user_path(resource)
end
else
clean_up_passwords(resource)
respond_with_navigational(resource) { render :partial => "devise/registrations/new" }
async_redirect_to new_user_registration_path
end
end
@@ -7,10 +7,11 @@ class DeviseAuth::SessionsController < Devise::SessionsController
end
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
resource = warden.authenticate!(:scope => resource_name)
async_redirect_to new_user_session_path unless resource
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
aysnc_redirect_to new_user_registration_path
async_redirect_to user_path(resource)
end
def destroy
+1
View File
@@ -4,6 +4,7 @@
.tabs_js.information
%h1
= artist.name
- if signed_in?
%span.heart
%ul.nav
%li= image_tag "icons/artist-info.png"
+1 -1
View File
@@ -11,7 +11,7 @@
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
<% end -%>
<p><%= f.submit "Sign in" %></p>
<p><%= f.submit "Login" %></p>
<% end %>
<%= render :partial => "devise/shared/links" %>
+1 -2
View File
@@ -1,7 +1,7 @@
Nineminutes::Application.routes.draw do
devise_for :users,
:controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations", :sessions => "sessions" }
:controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "devise_auth/registrations", :sessions => "devise_auth/sessions" }
devise_scope :user do
get "/users/auth/:provider" => "users/omniauth_callbacks#passthru"
get "/register" => "devise_auth/registrations#new", :as => :new_user_registration
@@ -11,7 +11,6 @@ Nineminutes::Application.routes.draw do
get "/logout" => "devise_auth/sessions#destroy", :as => :destroy_user_session
end
get "tracks/index"
match "/search_video", :to => "tracks#search_video"
resources :artists, :only => [ :show ], :constraints => { :id => /.*/ }