Closed arrowcircle closed 1 year ago
@arrowcircle Can you add some more context around how you're calling this? Normally just including the PasswordlessControllerHelpers
module and then calling sign_in
should do the trick. https://github.com/mikker/passwordless#registering-new-users
I'm getting the same thing...
This is what I have:
class ApplicationController < ActionController::Base
include Passwordless::ControllerHelpers
# ...
end
class UsersController < ApplicationController
# ...
def create
@user = User.new(user_params)
if challenge_accepted? && @user.save
sign_in @user
redirect_to alerts_path
else
render :new, status: :unprocessable_entity
end
end
# ...
end
And in my logs I see the same message.
This is from following the docs here: https://github.com/mikker/passwordless#registering-new-users
Everything still works... but the deprecation warning is just strange.
Just a followup: I am get this warning as well, so I took a look at the source code. The warning makes sense when reading the code, which gives preference to Password::Session
over another type of class instance, like our collective User models.
If you want the warning to go away, you would build a Password::Session
, and pass that to the sign_in
method, even though the README advises you pass in an instance of your authenticatable class. I image it's this way because there might be plans to expose a Password::Session
builder.
The current, non-deprecated way is this:
def create
@user = User.new(user_params)
if @user.save
sign_in(build_passwordless_session(@user)) # <-- This!
redirect_to(@user, flash: { notice: 'Welcome!' })
else
render(:new)
end
end
Hey! I just found this warning and cant figure why I have this warning:
It's not clear from this warning what to do. Any ideas how to fix this?