search for: sessions_control

Displaying 12 results from an estimated 12 matches for "sessions_control".

2012 Feb 03
10
ruby on rails 3 tutorial book chapter9 Signin Failure
Hi I have problem trying to pass the signin failure test. This is the test code of the sessions_controller.rb def create user = User.authenticate(params[:session][:email], params[:session][:password]) if user.nil? flash.now[:error] = "Invalid email/password combination." @title = "Sign in" render '...
2007 Dec 23
3
InvalidAuthenticityToken problems with my login form
...ronment.rb config.action_controller.session = { :session_key => ''myappname'', :secret => ''6de86b5566d7598f57e757960760acd2'' } in my application.rb protect_from_forgery :secret => ''6de86b5566d7598f57e757960760acd2'' my sessions_controller.rb doesn''t have anything new inside... same code as used with rails 1.2 (is it right ?) class SessionsController < ApplicationController def new @login = "" end def create if open_id?(params[:login]) open_id_authentication params[:login] else...
2012 Feb 16
0
Upgrading from 3.2.0 to 3.2.1: Wrong Number of Arguments
...;' find("#notice").should have_content("Album deleted successfully") Album.count.should eq 2 end But fails in 3.2.1 with: 1) Albums destroys an album Failure/Error: login_admin ArgumentError: wrong number of arguments (0 for 1) # ./app/controllers/sessions_controller.rb:8:in `create'' # (eval):2:in `click_button'' # ./spec/requests/albums_spec.rb:7:in `block (2 levels) in <top (required)>'' Line 8 in sessions_controller is: user = User.find_by_email(params[:email]) What''s going on here? Here''s th...
2010 Jul 06
4
Simple routing problem
I''ve got the following in config\routes.rb: map.resources :users In app\views\shared\_menu.erb, I''ve got: Please sign in <%= link_to "here", :controller=>"user", :action=>"sign_in" -%> In app\controllers\users_controller.rb def sign_in end When I run the application, I crash with: Routing Error No route matches
2012 May 12
12
before_save messing up
...attr_accessible :email, :name, :password, :password_confirmation has_secure_password before_save :create_remember_token . . . . . . . private def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end end #sessions_controller.rb -------> Sessions Controller class SessionsController < ApplicationController def new end def create user = User.find_by_email(params[:session][:email]) if user && user.authenticate(params[:session][:password]) sign_in user redirect_to user else...
2013 Aug 26
2
linkedin login using omniauth
...der, :uid)).first_or_initialize.tap do |user| user.provider = auth.provider user.uid = auth.uid user.name = auth.info.name user.oauth_token = auth.credentials.token user.oauth_expires_at = Time.at(auth.credentials.expires_at) user.save! end end /controller/sessions_controller.rb class SessionsController < ApplicationController def create user = User.from_omniauth(env["omniauth.auth"]) session[:user_id] = user.id redirect_to root_url end def destroy session[:user_id] = nil redirect_to root_url, :notice => "Signed out!" e...
2009 Jan 13
0
optional authentication and HTTP Basic
...e, since authentication is purely optional. This is a bigger problem than one might expect, since there''s a desktop client in development that requires the ability to login with HTTP Basic URL auth. They way I hacked around it was to create an action that looks like this: app/controllers/sessions_controller.rb def challenge authenticate_or_request_with_http_basic APP_NAME do |login, password| @user = User.authenticate(login, password) end if @user self.current_user = @user render_ok end end so browser clients (including the problematic desktop client) can GET...
2009 Jan 14
0
ActionController::InvalidAuthenticityToken
You will need: skip_before_filter :verify_authenticity_token in your sessions_controller.rb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group,...
2013 Jul 05
0
Sign in and sign out
...rs in Ruby on Rails. I read RoR Tutorial from http://ruby.railstutorial.org/chapters/sign-in-sign-out#top to sign in and sign out my app. I implemented the same configuration as it said: *sessions_helper.rb* def sign_out self.current_user = nil cookies.delete(:remember_token) end *sessions_controller.rb* def destroy sign_out redirect_to root_url end *application.html.erb* <%= link_to "Sign out", signout_path, method: "delete" %> *routes.rb* match ''/signout'', to: ''sessions#destroy'', via: ''delete'...
2011 Jul 28
2
rails 3 routing error
Here''s the error: 1) SessionsController GET ''new'' should be successful Failure/Error: get :new ActionController::RoutingError: No route matches {:controller=>"sessions", :action=>"new"} # ./spec/controllers/sessions_controller_spec.rb:8:in `block (3 levels) in <top (required)>'' 2) SessionsController GET ''new'' should have the right title Failure/Error: get :new ActionController::RoutingError: No route matches {:controller=>"sessions", :action=>"n...
2009 Mar 12
5
InvalidAuthenticityToken from home page
I''m trying to create a log in in index.html, but I keep getting an error about InvalidAuthenticityToken. I understand this is something that RoR puts in the forms, and it changes regularly. The problem is that the home page in the public folder is html, and therefore static. has anyone else put a log in on their home page? -- Posted via http://www.ruby-forum.com/.
2008 Jan 16
5
named route new_session not working
Anyone have any idea why a named route would NOT work? I did rake routes to make sure it was there and it was but for some reason new_session doesn''t work. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,