Avoid trying to access user if association does not exist

This might happen if the user was deleted before the token was activate
https://sentry.openproject.com/sentry/saas-openproject/issues/65
pull/6932/head
Oliver Günther 6 years ago
parent f10a1025d3
commit 95fb2f7b8a
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 2
      app/controllers/account_controller.rb

@ -157,7 +157,7 @@ class AccountController < ApplicationController
def activate
token = ::Token::Invitation.find_by_plaintext_value(params[:token])
if token.nil? || token.expired?
if token.nil? || token.expired? || token.user.nil?
handle_expired_token token
elsif token.user.invited?
activate_by_invite_token token

Loading…
Cancel
Save