authlogic

AuthLogic perishable_token resets on every request

倾然丶 夕夏残阳落幕 提交于 2019-12-18 13:31:06
问题 In my User model I have: acts_as_authentic do |c| c.perishable_token_valid_for = 30.minutes end In my Application Controller I have the standard boilerplate code: def current_user_session return @current_user_session if defined?(@current_user_session) @current_user_session = UserSession.find end def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session.record end Now in my view I need to see if a user is logged in: <% if

Ruby on Rails: Best way to add Facebook login, Twitter login, OpenID login, etc

泄露秘密 提交于 2019-12-18 11:56:39
问题 I'm currently running on a Ruby on Rails app with Authlogic handling my authentication and user management. I'm struggling to find up to date information on the best way to add 3rd party login methods to my site, supplementing the standard sign up and login. There are a number of tutorials out there, but all seem to be outdated or incomplete. Could I get some recommendations on the best way to add multiple 3rd party login methods to Authlogic? Authlogic appears to be built from the ground up

How to manually create a new user and user session in Devise?

扶醉桌前 提交于 2019-12-18 10:12:25
问题 I have a form where I collect a lot of information in Rails. Part of this form is fields for a new user to register. Since Devise has controllers/actions specifically to create a new user, I don't know how to programmatically create a user in an entirely different action that also creates another record. I really can't have the user registration form separate. I can't figure out how to create a user, and then log the user in, like I could easily do in Authlogic. I have used both Authlogic and

Authlogic throws errors on Heroku

扶醉桌前 提交于 2019-12-13 15:12:01
问题 I am trying to stage an app on Heroku that uses the Authlogic plugin. The Logs show me this error. I first thought there is a problem with the gem version, but I tried several: 2.1.1, 2.1.2, 2.1.3. But I tried deploying the authlogic example but it throws the same error. Thank you for your time. Processing UserSessionsController#new (for 188.27.118.88 at 2009-10-03 01:34:08) [GET] Parameters: {"action"=>"new", "controller"=>"user_sessions"} Rendering template within layouts/account Rendering

UserSession.find returns nil after changing password

荒凉一梦 提交于 2019-12-13 04:19:57
问题 I recently created a way to change the current user password, however after saving the record, my UserSession.find returns nil, I tried by writing UserSession.new({...}).save with no luck, any suggestion on how to resolve this issue? Here is my code, notice that is run through an AJAX request (this is a method under UserSessionController): def change_my_password #print "--------------RECORD: #{current_user_session.record.as_json}-------- #{current_user_session.user.as_json}" user = current

Getting undefined method `username' for #<UserSession: no credentials provided> with Authlogic after push to production

独自空忆成欢 提交于 2019-12-13 04:09:09
问题 We've never gotten this app to run in production. The application runs just fine in dev. I've made sure all rake tasks are up to date and acts_as_authentic is set for the user and everything else that everyone has posted on all the forums. The server has been bounced multiple times. This error comes up every single time on all URLs. Details below: NoMethodError in User_sessions#new Showing app/views/user_sessions/new.html.erb where line #6 raised: undefined method `username' for #<UserSession

An AuthLogic form is giving me incorrect validation errors — why?

五迷三道 提交于 2019-12-12 18:32:38
问题 I set up AuthLogic for Rails according to the AuthLogic example: http://github.com/binarylogic/authlogic_example. I can log on successfully to the system, but when accessing users/new.html.erb to register a new user, the form returns the following validation errors: Email is too short (minimum is 6 characters) Email should look like an email address. Login is too short (minimum is 3 characters) Login should use only letters, numbers, spaces, and .-_@ please. Password is too short (minimum is

Rails 3 Notices don't work when using Redirect_To

自闭症网瘾萝莉.ら 提交于 2019-12-12 13:19:31
问题 I've got some code I have a :notice, which is only showing up selectively. Here's the code respond_to do |format| if @userhj.save format.html { redirect_to(:action => :index, :notice => 'Succesfully assigned job') } format.xml { render :xml => @userhj, :status => :created, :location => @userhj } else format.html { redirect_to(:root, :notice => 'Duplicate job assignment') } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end When redirecting to :index from the

using different session model name in Authlogic

五迷三道 提交于 2019-12-12 05:57:21
问题 I changed UserSession model name to Session in Authlogic gem but i'm getting this error. NoMethodError in SessionsController#new undefined method `login_field' for Object:Class Is it forbidden to use Session as a model name ? db schema create_table "users", :force => true do |t| t.string "login" t.string "email" t.string "crypted_password" t.string "password_salt" t.string "persistence_token" t.string "perishable_token" t.datetime "created_at" t.datetime "updated_at" end sessions_controller

Rails + Authlogic @current_user problem - “Show” method no longer works

99封情书 提交于 2019-12-12 02:27:59
问题 I implemented Authlogic in my rails app which works and tests great. Users can login, logout, etc. However, since I changed my methods in the users_controller to use the @current_user variable, none of my user methods or forms (other than "index" strangely...) work! For example, this "Show" methods works and shows the user profile for any user (Note: I want to eventually restrict this to the currently logged in user somehow): def show @user = User.find(params[:id]) end If I follow the show