Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign in possibly succeeds for null user #987

Open
robingram opened this issue Dec 5, 2022 · 0 comments
Open

Sign in possibly succeeds for null user #987

robingram opened this issue Dec 5, 2022 · 0 comments

Comments

@robingram
Copy link

I wonder if you might have any insight into a strange error that we're getting.

We've been receiving occasional exceptions (a few per week) from our sessions controller where the result of sign_in is success but the user record is nil. Our create action is pretty standard:

def create
  @user = authenticate(params)

  sign_in(@user) do |status|
    if status.success?
      after_login_actions
      redirect_back_or url_after_create
    else
      flash.now.alert = error_message
      render :new, status: :unauthorized
    end
  end
end

after_login_actions is really simple but the first thing it does is call a method on @user, and this is where were getting the errors because @user is nil.

We don't have any custom sign in guards so we're a little confused about why sign_in is either succeeding for an empty user record or blanking it itself somehow.

Any suggestions on what might be causing this or steps to diagnose what's happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant