2009-11-17 63 views
4

我有authlogic使用gaizka的authlogic_openid版本,我發現在Github上自動註冊,因爲pelle的原始添加功能似乎會導致問題。authlogic auto_register功能使用我的選項

http://github.com/gaizka/authlogic_openid

using authlogic to auto create users bypassing explicit user registeration

使用auto_register功能,它忽略了我的authlogic選項,例如從OpenID提供檢索電子郵件時,這一個工作然而細...任何想法我在做什麼錯?

Hhere的例子:

http://big-glow-mama.heroku.com/

http://github.com/holden/authlogic_openid_selector_example/tree/with-facebook/

你可以看到區別,如果你註冊與登錄...

#user.rb 
class User < ActiveRecord::Base 
    acts_as_authentic do |c| 
    c.validate_login_field = false 
    # optional, but if a user registers by openid, he should at least share his email-address with the app 
    c.validate_email_field = false 
    # fetch email by ax 
    c.openid_required_fields = [:email,"http://axschema.org/contact/email"] 
    #c.required_fields = ["http://axschema.org/contact/email"] 
    # fetch email by sreg 
    #c.optional_fields = ["email"] 
    end 

    #private method to deal with emails goes here 

end 


#UserSession.rb 
class UserSession < Authlogic::Session::Base 
    auto_register 
    logout_on_timeout true 
end 

回答

4

這一個工作正常不過當使用auto_register功能時,它會忽略authlogic這樣的選項從openid提供商那裏檢索電子郵件......任何想法我做錯了什麼?

處理自動註冊的代碼存在於authlogic_openid的Session模塊中。處理註冊的代碼(檢索電子郵件表單提供者等),位於ActsAsAuthentic模塊中。

第一個是處理UserSession對象,後者是處理User對象。

我會在幾天後看看可以做些什麼來合併這兩種行爲。

+1

你能找出合併行爲的方法嗎? – 2010-05-21 15:44:39