mikker / passwordless

๐Ÿ— Authentication for your Rails app without the icky-ness of passwords
MIT License
1.26k stars 85 forks source link

Set a custom controller for `passwordless_for` routes. #152

Closed henrikbjorn closed 1 year ago

henrikbjorn commented 1 year ago

Closer to using multiple models in the same project. E.g providing Devise like support for ActiveAdmin but with Passwordless

module Admin
  class SessionsController < Passwordless::SessionsController
    layout 'admin'
  end
end
passwordless_for :users
passwordless_for :admin_users, controller: 'admin/sessions'
mikker commented 1 year ago

I appreciate the effort!

I feel like if you're already using your own custom controller, you may as well set up your own routes too. It's only 4 lines that are easily copied.

I don't want to have to support an option like this at this point.

henrikbjorn commented 1 year ago

I appreciate the effort!

I feel like if you're already using your own custom controller, you may as well set up your own routes too. It's only 4 lines that are easily copied.

I don't want to have to support an option like this at this point.

It seems like a natural extension point instead of copy pasting the helper method, and making sure that the authenticable default params etc. are present.

Previously I defaulted to do something like this:

Rails.configuration.to_prepare do
  Passwordless::SessionsController.class_eval do
    layout 'passwordless'
  end
end

Also before I make another PR. I would like to use a custom mailer and thought about adding Passwordless.mailer just like devise does.

mikker commented 1 year ago

Change of heart. This is good! Thank you @henrikbjorn for contributing and for sticking to it. โค๏ธ๐Ÿงก๐Ÿ’›๐Ÿ’š๐Ÿ’™๐Ÿ’œ