Tag: authlogic

Rails,没有密码的Authlogic(注册确定.user_sessionvalidation失败)

我试图跳过Authlogic中用户的密码.. 多亏了SO,我找到了创建用户的解决方案 User acts_as_authentic do |c| c.validate_password_field = false c.validate_email_field = false end User_session仍然存在问题 – 任何时候我尝试登录我都会得到“密码不能为空” 如何绕过用户会话的validation?

Ruby on rails – Authlogic:定期检查用户会话是否有效

我正在寻找一个解决方案,允许我定期检查用户会话是否已过期,如果是,则将其重定向到登录页面。 我正在使用Authlogic gem,所以我正在做的是调用一个在current_user上进行测试的函数。 我的USER_SESSION_TIMEOUT是5分钟,所以我每隔5:10分钟进行一次这个ajax调用。 {:controller => ‘user_session’, :action => ‘check_session_timed_out’}, :frequency => (USER_SESSION_TIMEOUT + 10.seconds) %> def check_session_timed_out if !current_user flash[:login_notice] = “Your session timed out due to a period of inactivity. Please sign in again.” render :update do |page| page.redirect_to “/user_sessions/new” end else render :nothing => true end end 我注意到每次调用current_user时都会更新用户对象,因此会话更新为5分钟。 打开一个选项卡时没有问题但是如果每次调用check_session_timed_out时都有2个选项卡,则current_user将更新用户,因此会话永不过期。 任何的想法? 谢谢

Ruby on Rails:添加Facebook登录,Twitter登录,OpenID登录等的最佳方式

我目前正在运行Ruby on Rails应用程序,Authlogic处理我的身份validation和用户管理。 我正在努力寻找有关向我的网站添加第三方登录方法的最佳方式的最新信息,补充标准注册和登录。 有很多教程,但似乎都过时或不完整。 我可以获得一些关于向Authlogic添加多个第三方登录方法的最佳方法的建议吗? Authlogic似乎是从头开始为这类事物构建的,但它的文档记录非常糟糕,并且它自己的页面似乎已经过时了。 他们似乎建议Facebook使用authlogic_facebook_connect插件,而插件依赖于过时的Facebookergem,后者已被Facebooker2取代。 有没有办法将Facebooker2与Authlogic一起使用? 我还在Google上找到了authlogic_oauth2 ,这是一个更现代的插件,可以使用OAuth2使用Facebook凭据登录。 不幸的是,作者声称由于冲突,此插件不能与OAuth(Twitter)和OpenID的Authlogic插件一起使用。 我可以一起使用哪些推荐的gem或插件来允许通过Facebook,Twitter和OpenID登录我的网站?

Rails:使用Authlogic进行基本身份validation

我正在使用Authlogic,我想在我的控制器中实现基本HTTP身份validation,以便我可以定义哪个操作需要身份validation。 我知道如何进行基本HTTP身份validationauthenticate_or_request_with_http_basic和before_filter,但我想在其他方面如何使用Authlogic插件实现它。 class ItemsController [:index, :create] … end

使用Authlogic进行集成测试?

对于我的生活,我不明白为什么Authlogic没有在这个集成测试中登录我。 我没有遇到任何问题,Authlogic使用此代码在function测试中登录我。 根据authlogic rdocs( http://tinyurl.com/mb2fp2 ),模拟登录状态在function和集成测试中是相同的,所以我很困惑。 任何帮助深表感谢! class TipsController [:destroy, :undelete] def destroy @tip = Tip.find(params[:id]) if can_delete?(@tip) @tip.destroy set_flash(“good”, “Tip deleted. Undo?”) respond_to do |format| format.html { redirect_to city_path(@tip.city)} end else set_flash(“bad”, “Seems like you can’t delete this tip, sorry.”) respond_to do |format| format.html { render :action => “show”, :id => @tip} end end […]

Ruby on Rails – request.env 返回nil

我正在尝试保存http_referer,以便我可以在用户登录后将用户发送回该URL。现在我的控制器中有一个before_filter,如果尚未通过redirect_to创建会话,则将它们发送到登录页面。 但是当我检查HTTP_REFERER时它是nil(而’REQUEST_URI’确实返回我最初来自的地方)。 谢谢。

为什么我得到未定义的方法`cookies’?

我正在尝试使用single_access_token为我的rails后端应用程序设置Authlogic(我正在使用rails-api gem)。 我正在关注这个例子: http : //blog.centresource.com/2013/06/04/using-ember-auth-with-rails-3-and-authlogic/ 到目前为止,我能够创建用户,但是当我尝试登录时,它在user_session.save上失败 : NoMethodError in Api::V1::UserSessionsController#create undefined method `cookies’ for # 根据我在这里找到的类似问题,我必须将Authlogic配置为: acts_as_authentic do |c| c.login_field = :email c.maintain_sessions = false end 在我的用户模型上。 然而,它一直在失败。 我假设当UserSession被保存时,Authlogic尝试更新User上的魔术字段,但我不知道为什么还在尝试使用cookie。

无论何处定向到登录页面,都会重定向到上一页

我正在使用Rails 3.2和Authlogic。 我有以下代码: class ApplicationController < ActionController::Base private def store_location session[:return_to] = request.url end def redirect_back_or_default(default) redirect_to(session[:return_to] || default) session[:return_to] = nil end end class UserSessionsController [:new, :create] before_filter :require_user, :only => :destroy def new @user_session = UserSession.new @header_title = “Login” end def create @user_session = UserSession.new(params[:user_session]) if @user_session.save flash[:success] = “Login successful!” redirect_back_or_default root_url […]

Ruby on Rails Authlogic密码无效

我正在尝试实现Authlogic。 注册很好,它将所有必要的细节输入我的数据库.. ..但是当我尝试登录时,它给了我错误: 1错误禁止保存此用户会话 以下字段存在问题: 密码无效 我的密码有效。 我不确定发生了什么。 有任何想法吗?

Authlogic在Heroku上抛出错误

我正在尝试使用Authlogic插件在Heroku上发布一个应用程序。 日志向我显示此错误。 我首先想到的是gem版本有问题,但我尝试了几个:2.1.1,2.1.2,2.1.3。 但我尝试部署authlogic示例,但它会抛出相同的错误。 感谢您的时间。 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 user_sessions/new ActionView::TemplateError (undefined method `login’ for #) on line #12 of app/views/user_sessions/new.html.haml: 9: = f.text_field :login 10: %li 11: = f.label :password, “Password:” 12: = f.password_field :password 13: %li 14: = f.label :password, “Remember […]