Sha256: 9722a90f0e47711a56f7e5450a435e1ad290877f6f1f39e68db1ea9832e4d442

Contents?: true

Size: 908 Bytes

Versions: 35

Compression:

Stored size: 908 Bytes

Contents

= Require multifactor authentication after login

You may want to require multifactor authentication on login for people
that have multifactor authentication set up. The +require_authentication+
Rodauth method works for pages that require an authenticated user, but not for
pages where authentication is optional.

You can set this up as follows:

  plugin :rodauth do
    enable :login, :logout, :otp

    # If you don't want to show an error message when redirecting
    # to the multifactor authentication page.
    two_factor_need_authentication_error_flash nil

    # Display the same flash message after multifactor
    # authentication than is displayed after login
    two_factor_auth_notice_flash { login_notice_flash }
  end

  route do |r|
    r.rodauth

    if rodauth.logged_in? && rodauth.two_factor_authentication_setup?
      rodauth.require_two_factor_authenticated
    end

    # ...
  end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
rodauth-2.36.0 doc/guides/require_mfa.rdoc
rodauth-2.34.0 doc/guides/require_mfa.rdoc
rodauth-2.33.0 doc/guides/require_mfa.rdoc
rodauth-2.32.0 doc/guides/require_mfa.rdoc
rodauth-2.31.0 doc/guides/require_mfa.rdoc
rodauth-2.30.0 doc/guides/require_mfa.rdoc
rodauth-2.29.0 doc/guides/require_mfa.rdoc
rodauth-2.28.0 doc/guides/require_mfa.rdoc
rodauth-2.27.0 doc/guides/require_mfa.rdoc
rodauth-2.26.1 doc/guides/require_mfa.rdoc
rodauth-2.26.0 doc/guides/require_mfa.rdoc
rodauth-2.25.0 doc/guides/require_mfa.rdoc
rodauth-2.24.0 doc/guides/require_mfa.rdoc
rodauth-2.23.0 doc/guides/require_mfa.rdoc
rodauth-2.22.0 doc/guides/require_mfa.rdoc
rodauth-2.21.0 doc/guides/require_mfa.rdoc
rodauth-2.20.0 doc/guides/require_mfa.rdoc
rodauth-2.19.0 doc/guides/require_mfa.rdoc
rodauth-2.18.0 doc/guides/require_mfa.rdoc
rodauth-2.17.0 doc/guides/require_mfa.rdoc