Class: Skydrive::SessionController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Skydrive::SessionController
- Defined in:
- app/controllers/skydrive/session_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/controllers/skydrive/session_controller.rb', line 3 def create user = User.where("username = ? OR email = ?", params[:username_or_email], params[:username_or_email]).first if user && user.authenticate(params[:password]) render json: user.session_api_key, status: 201 else render json: {}, status: 401 end end |