module Composable module Pwdless module RouterHelpers def composable_pwdless_for(resource, controller: nil, as: nil) as ||= resource.to_s controller ||= "/composable/pwdless/auth" constraints(->(req) { (req.env["composable_pwdless_resource"] = resource.to_s).present? }) do scope resource.to_s, as: as do get "/sign_in", to: "#{controller}#new", as: :sign_in post "/sign_in", to: "#{controller}#create" put "/sign_in", to: "#{controller}#update" match "/sign_out", to: "#{controller}#destroy", via: :delete, as: :sign_out end end end end end end