Skip to content
Janko Marohnić edited this page Aug 29, 2023 · 1 revision

All Rodauth configuration methods are just syntax sugar for defining instance methods on the auth class. If you want to define custom methods, you can either use auth_class_eval or define them outside of the configure block:

class RodauthMain < Rodauth::Rails::Auth
  configure do
    password_match? { |password| ldap_valid?(password) }
  end

  def admin?
    rails_account.admin?
  end

  private

  def ldap_valid?(password)
    SimpleLdapAuthenticator.valid?(account[:email], password)
  end
end
rodauth.admin? #=> true
Clone this wiki locally