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_422, #render_registration, #render_session

Instance Method Details

#createObject



6
7
8
9
10
11
# File 'app/controllers/rails_jwt_auth/confirmations_controller.rb', line 6

def create
  user = RailsJwtAuth.model.where(email: confirmation_create_params[:email]).first
  return render_422(email: [{error: :not_found}]) unless user

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

#updateObject



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

def update
  return render_404 unless
    params[:id] &&
    (user = RailsJwtAuth.model.where(confirmation_token: params[:id]).first)

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