开发者

Use Authlogic with Typus

I'm switching to Typus because I prefer its UI over ActiveScaffold and I love the way you can set roles for the admin section. We need that.

However, where ActiveScaffold worked flawlessly with Authlogic, Typus doesn't. I'd like to combine the two anyway, but can't seem to find out how. Typus has very basic password encryption, but I can't write a crypto_provider for it, because it depends on a very simple Sha1-encryption of the salt and the password. Authlogic doesn't support that, because it doe开发者_运维技巧sn't send along the actual password.

I'd hate it if we had to use two User models for the front- and backend. I don't need Authlogic to be the authentication method for Typus, but they should both at least be able to compare the password with the crypted one.

Is there anyone out there who has worked around this issue?

Thank you.


I'm not entirely happy with it, but I think I've found an answer to my own question.

I've let Typus create the AdminUser, added a user_id to it and added this method to it and I call it in a before_save:

  def sync_user
    self.user ||= User.find_by_email(self.email)
    if user = self.user
      user.email = self.email
      user.password = self.password
      user.password_confirmation = self.password_confirmation
      user.save
    end
  end

This seems to do the trick for me. I'd love to do it differently, but it works for now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜