Configuration

Lato's configuration is managed by the Lato::Config class and can be customized through a dedicated initializer.
To override the default settings, create an initializer and add the following code:

Lato.configure do |config|
  config.application_title = 'Lato example app'
  config.session_root_path = :tutorial_path
end

Source code: Example
Source code: Lato::Config

Application Configuration

Lato.configure do |config|
  config.application_title = 'Lato example app' # Application title
  config.application_company_name = 'Lato Team' # Name of the owning company
  config.application_company_url = 'http://domain.com' # URL of the owning company
end

Authentication Configuration

Lato.configure do |config|
  config.auth_disable_signup = true # Disable user self-signup
  config.auth_disable_recover_password = true # Disable password recovery
  config.auth_disable_web3 = true # Disable Web3 wallet login
  config.auth_disable_authenticator = true # Disable Google Authenticator login
end

HCaptcha Configuration

HCaptcha is a service that helps protect websites from spam and abuse by using advanced risk analysis techniques. By integrating HCaptcha into your application, you can add an extra layer of security to authentication forms.

Lato.configure do |config|
  config.hcaptcha_site_key = 'your-hcaptcha-site-key'
  config.hcaptcha_secret = 'your-hcaptcha-secret'
end

Assets Configuration

Lato.configure do |config|
  config.assets_stylesheet_entry = 'application' # CSS file for Lato styling (default: application.scss)
  config.assets_importmap_entry = 'application' # JS entry point for Lato (default: application.js)
end

Session Management Configuration

Lato.configure do |config|
  config.session_lifetime = 5.days # Lifetime of session cookies
  config.session_root_path = :tutorial_path # Path to redirect users after login/signup
end

Email Configuration

Lato.configure do |config|
  config.email_from = 'demo@mail.com' # Sender email address for notifications
end

Note

The email_from setting can include a display name using the format "Name" <example@domain.com>.
Example:

Lato.configure do |config|
  config.email_from = '"Company name" <demo@mail.com>'
end

Legal Information Configuration

Lato.configure do |config|
  config.legal_privacy_policy_url = 'http:/domain.com/privacy' # Privacy policy URL
  config.legal_privacy_policy_version = 32 # Version number of the active privacy policy
  config.legal_terms_and_conditions_url = 'http:/domain.com/terms' # Terms and conditions URL
  config.legal_terms_and_conditions_version = 32 # Version number of the active terms and conditions
end

Note

Lato tracks which version of the privacy policy and terms the user has accepted.
If the logged-in user has accepted a version lower than the one configured via legal_privacy_policy_version or legal_terms_and_conditions_version, a prompt will appear in the account management page to accept the new policies.

To check whether a user has accepted the latest policy versions, use the valid_accepted_privacy_policy_version? and valid_accepted_terms_and_conditions_version? methods on instances of the Lato::User model.
Example:

user = Lato::User.all.first
throw "Privacy policy not accepted" unless user.valid_accepted_privacy_policy_version?
throw "Terms and conditions not accepted" unless user.valid_accepted_terms_and_conditions_version?

Account Connection Configuration

Lato.configure do |config|
  config.web3_connection = true # Allow users to link a Web3 wallet to their account
  config.authenticator_connection = true # Allow users to link Google Authenticator to their account
end

Source code: Lato::User

You are offline You are online