标签: authlogic

使用Facebook Connect with Authlogic

我正在尝试使Authlogic和Facebook Connect(使用Facebook)发挥得很好,这样您就可以通过正常注册方式或Facebook连接创建帐户.我已经能够以一种方式使连接工作,但只登出facebook上的logg而不是我的网站,我必须删除cookie才能使其正常工作.任何帮助都会很棒,谢谢!

ruby facebook ruby-on-rails authlogic facebooker

6
推荐指数
1
解决办法
6829
查看次数

使用Authlogic发送注册验证电子邮件?

有没有什么办法可以让authlogic在他们注册后向我的订阅者发送电子邮件,以便他们可以确认他们的帐户?

ruby-on-rails authlogic

5
推荐指数
1
解决办法
3450
查看次数

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

我正在寻找一个解决方案,允许我定期检查用户会话是否已过期,如果是,则将其重定向到登录页面.
我正在使用Authlogic gem,所以我正在做的是调用一个在current_user上进行测试的函数.
我的USER_SESSION_TIMEOUT是5分钟,所以我每隔5:10分钟进行一次这个ajax调用.

<%= periodically_call_remote :url => {:controller => 'user_session', :action => 'check_session_timed_out'}, :frequency =>  (USER_SESSION_TIMEOUT + 10.seconds) %>
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)

我注意到每次调用current_user时,用户对象都会更新,因此会话更新为5分钟.
打开一个选项卡时没有问题但是如果每次调用check_session_timed_out时都有2个选项卡,则current_user将更新用户,因此会话永不过期.

任何的想法?谢谢

session ruby-on-rails session-timeout authlogic

5
推荐指数
2
解决办法
3913
查看次数

使用Authlogic时如何编写和测试密码更改?

我继承的应用程序具有以下更新用户配置文件的操作:

class UsersController < ApplicationController
  # ...
  def update
    @user = current_user
    if @user.update_attributes(params[:user])
      flash[:notice] = "Successfully updated profile."
      redirect_to root_url
    else
      flash[:error] = "Hrm, something went wrong."
      render :action => 'edit'
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

表单PUTS(真的POSTS采用一_method=PUT)该操作有一个passwordpassword_confirmation领域,但没有old_password现场.我通过测试注意到我甚至不需要填写该password_confirmation字段.

第一个问题:使用Authlogic时是否有更成熟的密码更改方式?

第二个问题:是否有关于密码更改的最佳实践(特别是从可用性角度)的文献?它应该是一个单独的表单,而不是与其他用户字段混合使用?

第三个问题:大多数网站都有一个old_password字段,但Authlogic似乎不支持本地.什么是Authlogic-ey方式确认它实际上是用户他/她自己更改密码而不是那些黑客入侵会话的人?

ruby testing ruby-on-rails authlogic

5
推荐指数
1
解决办法
1094
查看次数

Rails 3,Authlogic,NGINX和HTTP基本身份验证不能很好地协同工作

我正处于使用Rails 3构建应用程序的早期阶段.用户身份验证由Authlogic提供支持,我已将其设置为标准(根据示例文档),并且所有内容都按预期在本地运行.

我刚刚将应用程序部署到Centos 5.4/NginX/Passenger的干净服务器安装中,因此工作人员可以开始登录并输入内容等.但是,我们还有很长的路要走,因为我已经为公众的眼睛做好了准备,所以我使用过NginX的基本身份验证模块,使整个站点保持在另一级别的身份验证之后.

不幸的是,Authlogic的身份验证和NginX的基本身份验证似乎相互冲突.如果打开了基本身份验证,则无法使用Authlogic登录,但如果禁用基本身份验证,则Authlogic将按预期工作.

我没有发布任何代码,因为我真的不确定哪些代码是相关的.我想知道这是否是一个已知问题,如果有任何更改,我可以对配置进行更改以解决问题?

ruby-on-rails nginx basic-authentication authlogic

5
推荐指数
1
解决办法
2060
查看次数

使用Authlogic仅使用用户名进行身份验证

这个应用程序位于Java(Struts)上,它也处理身份验证.我的Rails应用程序正在集成到母应用程序中使用authlogic.当然,要求是,一旦有人登录到母应用程序,他们应该能够自动访问我的Rails应用程序而无需再次登录.

有没有办法,只使用用户ID,我可以使用Authlogic验证用户?

我删除了Users表中的密码列,并将这段代码粘贴到User模型中.

acts_as_authentic do |config|
  config.check_passwords_against_database = false
  config.validate_password_field = false
  config.crypted_password_field = false
end
Run Code Online (Sandbox Code Playgroud)

但是我仍然无法做我想做的事情.我收到一个错误,表明密码不能为空.请帮助!谢谢.

ruby-on-rails authlogic

5
推荐指数
1
解决办法
824
查看次数

使用rspec和authlogic进行测试时用户登录

我有一个测试控制器的规范如下

require 'spec_helper'

describe ProductsController do
setup :activate_authlogic

describe "user not logged in" do

it "should not GET index" do
get :index
response.should redirect_to(login_path)
end

end

describe "user logged in" do

before(:each) do
UserSession.create :username => "rohit", :password => "test123"
end

it "should GET index" do
get :index
response.should redirect_to(products_path)
end

end

end
Run Code Online (Sandbox Code Playgroud)

我也在spec_helper.rb中使用过这一行

require "authlogic/testcase"
Run Code Online (Sandbox Code Playgroud)

"用户未登录通过"但"登录用户"的测试失败

'ProductsController user is logged in should GET index' FAILED
expected redirect to "/products", got no redirect
Run Code Online (Sandbox Code Playgroud)

ruby testing rspec ruby-on-rails authlogic

5
推荐指数
1
解决办法
4143
查看次数

Authlogic不能做什么设计?

rails社区似乎离开了Authlogic,转而支持Devise.我一直使用Authlogic超过一年,想知道原因是什么.它只是营销,还是有充分的理由呢?我已经使用过Devise并且更喜欢Authlogic,但如果有充分的理由进行切换我当然会.

我在Devise上读了很多,但我没有看到兴奋的来源.我喜欢Devise的主要原因是因为社区支持 - 在撰写本文时,stackoverflow对Authlogic有605个问题,对Devise有2580个问题.

任何输入都非常感谢.

authlogic devise

5
推荐指数
1
解决办法
485
查看次数

Rails 3:控制台中的Authlogic出错

我正在尝试在控制台中创建一些用户.我收到以下错误:

Authlogic::Session::Activation::NotActivatedError: You must activate the Authlogic::Session::Base.controller with a controller object before creating object
Run Code Online (Sandbox Code Playgroud)

after_create中发生此错误,只有作业是向用户发送电子邮件.如果我禁用此after_create,一切正常,但这意味着没有发送电子邮件.

我尝试应用此处找到的解决方案,但它不起作用:

http://www.tatvartha.com/2009/09/working-with-authlogic-in-scriptconsole/

这是怎么回事?

谢谢

authlogic ruby-on-rails-3

5
推荐指数
0
解决办法
198
查看次数

Rails GrapeAPI + Authlogic未定义方法“会话”

我正在尝试使用GrapeAPI和构建用于登录的API Authlogic

我的代码如下所示:

class Api
  class V1
    class UserSessionsController < Grape::API


    post :login do
      @user_session = UserSession.new(params[:user_session])
      if @user_session.save
        fetch_api_key(@user_session.user)
      else
        error!('Unauthorized.', 401)
      end
    end

    helpers do
      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.user
       end

      end

    end
  end
end
Run Code Online (Sandbox Code Playgroud)

问题是当我跑步时@user_session = UserSession.new(params[:user_session])我会得到You must activate the Authlogic::Session::Base.controller with a controller object before creating objects

我尝试添加

Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)

在尝试创建之前UserSession …

ruby ruby-on-rails authlogic grape-api

5
推荐指数
0
解决办法
183
查看次数