Class: RailsJwtAuth::ConfirmationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
ParamsHelper, RenderHelper
Defined in:
app/controllers/rails_jwt_auth/confirmations_controller.rb

Instance Method Summary collapse

Methods included from RenderHelper

#render_204, #render_404, #render_410, #render_422, #render_profile, #render_registration, #render_session

Instance Method Details

#createObject

used to resend confirmation



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/rails_jwt_auth/confirmations_controller.rb', line 21

def create
  unless @user
    if RailsJwtAuth.avoid_email_errors
      return render_204
    else
      return render_422(RailsJwtAuth.email_field_name => [{error: :not_found}])
    end
  end

  @user.send_confirmation_instructions ? render_204 : render_422(@user.errors.details)
end

#showObject

used to verify token



10
11
12
13
14
15
16
17
18
# File 'app/controllers/rails_jwt_auth/confirmations_controller.rb', line 10

def show
  return render_404 unless @user

  if user.confirmation_sent_at < RailsJwtAuth.confirmation_expiration_time.ago
    return render_410
  end

  render_204
end

#updateObject

used to accept confirmation



34
35
36
37
38
# File 'app/controllers/rails_jwt_auth/confirmations_controller.rb', line 34

def update
  return render_404 unless @user

  @user.confirm ? render_204 : render_422(@user.errors.details)
end