Class: RailsJwtAuth::InvitationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsJwtAuth::InvitationsController
- Includes:
- AuthenticableHelper, ParamsHelper, RenderHelper
- Defined in:
- app/controllers/rails_jwt_auth/invitations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
used to invite a user, if user is invited send new invitation.
-
#show ⇒ Object
used to verify token.
-
#update ⇒ Object
used to accept invitation.
Methods included from RenderHelper
#render_204, #render_404, #render_410, #render_422, #render_profile, #render_registration, #render_session
Methods included from AuthenticableHelper
#authenticate, #authenticate!, #current_user, #get_jwt_from_request, #jwt_payload, #signed_in?, #track_request, #unauthorize!
Instance Method Details
#create ⇒ Object
used to invite a user, if user is invited send new invitation
18 19 20 21 |
# File 'app/controllers/rails_jwt_auth/invitations_controller.rb', line 18 def create user = RailsJwtAuth.model.invite(invitation_create_params) user.errors.empty? ? render_204 : render_422(user.errors.details) end |
#show ⇒ Object
used to verify token
11 12 13 14 15 |
# File 'app/controllers/rails_jwt_auth/invitations_controller.rb', line 11 def show return render_404 unless @user @user.expired_invitation_token? ? render_410 : render_204 end |
#update ⇒ Object
used to accept invitation
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/rails_jwt_auth/invitations_controller.rb', line 24 def update return render_404 unless @user if @user.accept_invitation(invitation_update_params) render_204 else render_422(@user.errors.details) end end |