Custom Methods - janko/rodauth-rails GitHub Wiki

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