Sha256: 1c37883fe256e6fa3fb78788a2914567fb451d5bb65853476695310f2880a74a

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

= Change route path

You can change the URL path of any Rodauth route by overriding the
corresponding <tt>*_route</tt> method:

  plugin :rodauth do
    enable :login, :logout, :create_account, :reset_password

    # Change login route to "/signin"
    login_route "signin"
    
    # Change redirect when login is required to "/signin"
    require_login_redirect { login_path }

    # Change create account route to "/register"
    create_account_route "register"

    # Change password reset request route to "/reset-password/request"
    reset_password_request_route "reset-password/request"
  end

If you want to add a prefix to all Rodauth routes, you should use the +prefix+
setting:

  plugin :rodauth do
    enable :login, :logout

    # Use /auth prefix to each Rodauth route
    prefix "/auth"
  end

  route do |r|
    r.on "auth" do
      # Serve Rodauth routes under the /auth branch of the routing tree
      r.rodauth
    end

    # ...
  end

There are cases where you may want to disable certain routes. For example, you
may want to enable the create_account feature to allow creating admins, but
only make it possible programmatically via internal requests. In this case,
you should set the corresponding <tt>*_route</tt> method to +nil+:

  plugin :rodauth, name: :admin do
    enable :create_account

    # disable the /create-account route
    create_account_route nil
  end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rodauth-2.36.0 doc/guides/paths.rdoc
rodauth-2.34.0 doc/guides/paths.rdoc
rodauth-2.33.0 doc/guides/paths.rdoc
rodauth-2.32.0 doc/guides/paths.rdoc
rodauth-2.31.0 doc/guides/paths.rdoc
rodauth-2.30.0 doc/guides/paths.rdoc
rodauth-2.29.0 doc/guides/paths.rdoc
rodauth-2.28.0 doc/guides/paths.rdoc
rodauth-2.27.0 doc/guides/paths.rdoc
rodauth-2.26.1 doc/guides/paths.rdoc
rodauth-2.26.0 doc/guides/paths.rdoc
rodauth-2.25.0 doc/guides/paths.rdoc