Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- SessionsController
- Defined in:
- app/controllers/sessions_controller.rb
Instance Attribute Summary
Attributes included from Authentication
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/sessions_controller.rb', line 7 def create if @user.authenticate_by_phone(create_params.dig(:otp)) start_new_session_for @user token = JwtAuthenticate.encode(user_id: @user.id) ok(token: token) else bad_request(Otp::Errors::InvalidOtpError.new.) end end |
#destroy ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/sessions_controller.rb', line 17 def destroy terminate_session ok end |