Class: EmailTokenValidation

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/concerns/email_token_validation.rb

Defined Under Namespace

Classes: EmailToken

Class Method Summary collapse

Class Method Details

.before(controller) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/concerns/email_token_validation.rb', line 2

def self.before(controller)
  @token = EmailToken.new(
    controller.params.fetch(:user_email, nil),
    controller.params.fetch(:email_authentication_token, nil)
  )

  if @token.valid?
    sign_out_current_scope
     token.user
    token.destroy
  end
end