Tag: authlogic

authlogic rails app中的无限循环

我有一个使用authlogic和facebook的rails应用程序。 在我第一次登录Facebook后不久,我的所有页面都停止响应并显示日志 Processing UserSessionsController#new (for [IP ADDRESS] at 2010-07-08 00:32:31) [GET] Parameters: {“action”=>”new”, “controller”=>”user_sessions”} SystemStackError (stack level too deep): (eval):5:in `connection_handler’ authlogic (2.1.5) lib/authlogic/session/callbacks.rb:83:in `validate’ authlogic (2.1.5) lib/authlogic/session/validation.rb:64:in `valid?’ authlogic (2.1.5) lib/authlogic/session/cookies.rb:110:in `persist_by_cookie’ authlogic (2.1.5) lib/authlogic/session/callbacks.rb:90:in `persist’ authlogic (2.1.5) lib/authlogic/session/persistence.rb:55:in `persisting?’ authlogic (2.1.5) lib/authlogic/session/persistence.rb:39:in `find’ authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:96:in `get_session_information’ authlogic (2.1.5) lib/authlogic/acts_as_authentic/session_maintenance.rb:95:in `each’ authlogic (2.1.5) […]

Rails + Authlogic @current_user问题 – “显示”方法不再有效

我在我的rails应用程序中实现了Authlogic,它的工作和测试非常好。 用户可以登录,注销等 但是,由于我在users_controller中更改了我的方法以使用@current_user变量,因此我的用户方法或表单(除了“索引”奇怪的……)都不起作用! 例如,这个“显示”方法可以工作并显示任何用户的用户配置文件(注意:我想最终以某种方式将此限制为当前登录的用户): def show @user = User.find(params[:id]) end 如果我按照Authlogic rails cast和官方示例中所示的show方法执行: def show @user = @current_user end 我得到各种undefined method METHOD for nil:NilClass错误。 尽管@current_user变量不包含任何用户信息。 我假设@current_user从current_user方法中提取信息,如下面的应用程序控制器中所定义: def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session.record end 我错过了什么? 我的预感是用户模型的User对象和current_user方法之间没有映射。 任何帮助将不胜感激! 提前致谢! 〜丹

AuthLogic UserSessions Controller返回Nil

我已经设置了一个新的Rails应用程序并使用Authlogic进行身份validation。 我很高兴CRUD用户,但用户会话似乎有问题。 错误信息: undefined method `create’ for nil:NilClass app/controllers/user_sessions_controller.rb:9:in `create’ 应用程序/模型/ user.rb class User < ActiveRecord::Base acts_as_authentic end 应用程序/控制器/ user_sessions_controller.rb class UserSession < Authlogic::Session::Base end 应用程序/模型/ user_session.rb class UserSessionsController < ApplicationController def new @user_sesssion = UserSession.new end def create @user_sesssion = UserSession.new(params[:user_session]) if @user_session.create flash[:notice] = "Welcome back!" redirect_to root_path else render :new end end […]

Facebooker params空

我正在尝试使用此http://github.com/kalasjocke/authlogic_facebook_connect连接facebooker和authlogic 我遇到了问题所以开始调试facebooker gem代码。 我意识到没有使用与Facebook有关的facebook登录设置params。 我可以按下Facebook登录按钮,它会显示Facebook窗口,我接受/登录Facebook。 然后在facebooker / rails / controller.secure_with_facebook_params中! 我打印出params,这是显示的: authenticity_tokenactioncreatecontrollerperson_sessions person_sessions是我的user_sessions的名称。 不确定这是否有所作为… 就是这个。 显然,这里应该有其他参数。 我检查确保我的应用程序编号与facebooker.yml一切正常(虽然老实说我不明白为什么这很重要,因为我还没有制作Facebook应用程序,只想使用连接)。 有任何想法吗?? 如果有人可以帮助我,我会很感激…任何线索都会有用! ķ

使用Authlogic和Rails 3.2.9时的路由错误

我已经通过引用https://github.com/jonathandean/authlogic_example为用户管理需求配置了authlogic gem。 我已经正确配置了一切。 我使用的是Rails 3.2.9和ruby 1.8.7。 当我使用localhost:3000时,我收到以下错误 Routing Error undefined method `filter_parameter_logging’ for ApplicationController:Class Try running rake routes for more information on available routes. 请帮忙解决这个问题。 谢谢你的帮助 :)-

authlogic UserSession.create(@user)给予unauthorized_record

我正在尝试显式创建一个像这个UserSession.create(@user, true)的会话UserSession.create(@user, true)但是没有创建会话, current_user是nil 。 但是当我这样做时,我得到“”}> us = UserSession.create(@user, true) RAILS_DEFAULT_LOGGER.info(us.inspect) #=> UserSession: {:unauthorized_record=>””} 我在这里看了一下Authlogic :: Session :: UnauthorizedRecord 小心这一点,因为Authlogic假设你已经确认用户是他所说的那个人。 例如,这是用于在内部持久保存会话的方法。 Authlogic查找具有持久性令牌的用户。 此时我们知道用户就是他所说的那样,因此Authlogic只是创建了一个记录会话。 这对于第三方身份validation方法(如OpenID)特别有用。 让该方法validation身份,一旦validation,传递对象并创建会话。 这正是我想要做的(我使用omniauth进行身份validation并使用authlogic创建会话)。 我如何解决这个问题,以便我可以在current_user获得有效的会话?

Rails:Polymorphic User Table与AuthLogic一个好主意?

我有一个系统,我需要从主页上的一个登录表单登录三种用户类型:客户,公司和供应商。 我创建了一个User表,该表根据AuthLogic的示例应用程序工作, url为http://github.com/binarylogic/authlogic_example 。 我添加了一个名为“用户类型”的字段,该字段当前包含“客户”,“公司”或“供应商”。 注意:每个用户类型包含许多不同的字段,因此我不确定单表inheritance是否是最好的方法(如果此结论无效,则欢迎更正)。 这是一个多态关联,其中三种类型中的每一种都用用户记录“标记”了吗? 我的模型应该如何显示,以便我的用户表和我的用户类型客户,公司,供应商之间有正确的关系? 非常感谢! —— UPDATE —— 目前的设置: #User model class User true end #Customer model (Company and Vendor models are similar) class Customer :authenticable acts_as_authentic end 这是设置它们的有效方法吗?

AuthLogic表单给出了错误的validation错误 – 为什么?

我根据AuthLogic示例设置了AuthLogic for Rails: http ://github.com/binarylogic/authlogic_example。 我可以成功登录到系统,但是当访问users / new.html.erb以注册新用户时,表单会返回以下validation错误: 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 4 characters) Password confirmation is too short (minimum […]

Rails OpenID身份validation插件不再安装Rake任务?

我正在关注使用OpenID和AuthLogic的Railscasts教程。 这个命令: $ script/plugin install git://github.com/rails/open_id_authentication.git 安装插件,但我没有看到任何OpenID Rake任务(rake -T)。 特别是,我不能再执行任务了: $ rake open_id_authentication:db:create 使用以前的应用程序,Rake任务安装没有问题,所以插件有什么变化? 我需要哪个版本的插件来获取我正在寻找的行为? 使用Rails 2.3.5。

无法在Rails 3.0.1上使用Authlogic设置current_user

我在Rails 2.3.5上运行了官方的authlogic插件。 我将我的应用程序转换为Rails 3.0.1,现在我遇到了一些问题。 我在我的gemfile gem’authlogic gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’, :branch => ‘rails3’包含了以下authlogic gem gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’, :branch => ‘rails3’ ,: gem ‘authlogic’, :git => ‘git://github.com/odorcicd/authlogic.git’, :branch => ‘rails3’ 用户登录时会保存会话。 调用该用户会话时,返回的值为nil。 UserSession.find returns a nil value因此我无法分配current_user。 sessions_controller.rb def create @user_session = UserSession.new(params[:user_session]) if @user_session.save! flash[:notice] = ‘Login successful’ redirect_to root_url else render […]