authlogic

Not able to set a current_user using Authlogic on Rails 3.0.1

梦想的初衷 提交于 2019-12-24 01:42:04
问题 I had the official authlogic plugin running perfectly on Rails 2.3.5. I converted my application to Rails 3.0.1 and now I'm having some problems. I've included the following authlogic gem in my gemfile gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' When a user logs in, the session is saved. When calling that user session, the returned value is nil. UserSession.find returns a nil value so I'm not able to assign a current_user. sessions_controller.rb def

Ruby on Rails Authlogic password not valid

徘徊边缘 提交于 2019-12-23 18:42:55
问题 I am trying to implement Authlogic. Registering is fine, it enters all the necessary details into my database.. .. but when I try to log in, it gives me the error: 1 error prohibited this user session from being saved There were problems with the following fields: Password is not valid My password is valid. I am not sure what is happening. Any ideas? 回答1: I had the same problem, and it was because I was migrating from Restful authentication. The issue was: Restful authentication puts a 40

Using Authlogic to authenticate with only a username

ぃ、小莉子 提交于 2019-12-23 10:20:10
问题 There's this mother app which is on Java (Struts), which also handles authentication. My Rails app which is being integrated into the mother app uses authlogic. Ofcourse, the requirement is, once someone logs into the mother app, they should automatically be able to access my Rails app without signing in again. Is there any way, by using just the user id , I can authenticate the user using Authlogic? I removed my password column in my Users table and stuck this piece of code into the User

How to get a list of online users in Authlogic?

我与影子孤独终老i 提交于 2019-12-23 05:36:13
问题 I've added a last_request_at field to my user table in Ruby on Rails, so now I can call the authlogic method User.logged_in.count and it returns the correct value. But how do I get a list of all logged in users? Thanks for reading. 回答1: User.logged_in.all ? 来源: https://stackoverflow.com/questions/3083129/how-to-get-a-list-of-online-users-in-authlogic

Authlogic and iPhone app login

倾然丶 夕夏残阳落幕 提交于 2019-12-22 08:41:01
问题 This has been a head-banger for me. I have looked at all of the similar questions on SO and none have proved satisfactory. Here's my go at it. I have a perfectly fine rails 3 app setup with Authlogic. I have been using Objective Resource (http://iphoneonrails.com/) to connect my iPhone app and my Rails app, and it has been working fine. Now is the time to add authentication, and I cannot figure it out. I have a UserSession class in my iPhone project with a username and password field. When

Authlogic: How to block certain IP addresses from signing up?

江枫思渺然 提交于 2019-12-22 00:18:06
问题 Using authlogic in a rails app, I want to prevent users from certain IP addresses to sign up (because of misuse). What would be the proper way to do that? 回答1: class SignupsController < ApplicationController before_filter :block_ip_addresses protected def block_ip_addresses head :unauthorized if current_ip_address == "XX.XX.XX.XX" end def current_ip_address request.env['HTTP_X_REAL_IP'] || request.env['REMOTE_ADDR'] end end 来源: https://stackoverflow.com/questions/10894408/authlogic-how-to

Configuring authlogic-oauth with google

余生长醉 提交于 2019-12-21 04:30:15
问题 I am trying to learn rails, and I'm working on an app that uses Google for logins and also for calendar data. I'm currently working on configuring authlogic-oauth and having some issues. I've been following the guide for the authlogic-oauth (see link above) plugin, and I'm on steps 4 and 5. First off, I am still learning the language and I'm not sure where the code from step 4 goes in the controllers: @user_session.save do |result| if result flash[:notice] = "Login successful!" redirect_back

Rails: Authorization with Authlogic

爱⌒轻易说出口 提交于 2019-12-20 14:43:09
问题 I need a very granular authorization system that works seamlessly with Authlogic. I've tried these gems/plugins so far: Lockdown rails_authorization_plugin ACL9 I've also looked at, but not tried implementing: Padlock I've searched around for a good tutorial detailing how to set up any of these with Authlogic in a way that makes sense (only the Lockdown doc seems to outline how to set this up with Authlogic), but have come up with next to nothing. The only one of these that made the remotest

Can't put email address field on login form (Authlogic)

走远了吗. 提交于 2019-12-20 08:49:38
问题 So I have Authlogic working fine with this user_sessions/new view: <% form_for @user_session, :url => user_session_path do |f| %> <% if @user_session.errors.present? %> Invalid username or password <% end %> <%= f.label :login %><br /> <%= f.text_field :login %><br /> <br /> <%= f.label :password %><br /> <%= f.password_field :password %><br /> <br /> <%= f.check_box :remember_me, :style => 'margin-right: 10px' %> <%= f.label :remember_me %><br /> <br /> <%= f.submit "Login" %> <% end %> But

How can I get authlogic to use the Rails session instead of its own cookie?

喜欢而已 提交于 2019-12-19 18:54:22
问题 I would like authogic to never set a user_credentials cookie, and only use the standard Rails session cookie. I see Session is included in Authlogic::Session::Session::Base after Cookies . If I log into my app and then delete the user_credentials cookie, I still stay logged in. So apparently authlogic is storing the credentials in both places and checking both places? Or ignoring the cookie but still setting it? How can I have it never set or reference the user_credentials cookie? 回答1: