Class: Ishapi::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ishapi::UsersController
- Defined in:
- app/controllers/ishapi/users_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#fb_sign_in ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/ishapi/users_controller.rb', line 9 def fb_sign_in :fb_sign_in, Ishapi # render :json => { :status => :ok } render :action => 'show' end |
#login ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/ishapi/users_controller.rb', line 19 def login @current_user = User.where( email: params[:email] ).first if !@current_user render json: { status: :not_ok }, status: 401 return end if @current_user.valid_password?(params[:password]) # from: application_controller#long_term_token # send the jwt to client @jwt_token = encode(user_id: @current_user.id.to_s) render json: { email: @current_user.email, jwt_token: @jwt_token, long_term_token: @long_term_token, n_unlocks: @current_user.profile.n_unlocks, } end end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/ishapi/users_controller.rb', line 15 def show :fb_sign_in, Ishapi end |