diff options
| author | mo khan <mo@mokhan.ca> | 2013-07-14 13:45:53 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-07-14 13:45:53 -0600 |
| commit | 8efc098556099356dd5a119f567a82ce015ea81c (patch) | |
| tree | 20af91f2867fdf95127524b0c8954326fdf78106 /app/controllers/api | |
| parent | a399e90073ff51324674f8467c1f164769b5e11c (diff) | |
add route to logins controller
Diffstat (limited to 'app/controllers/api')
| -rw-r--r-- | app/controllers/api/v1/logins_controller.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/api/v1/logins_controller.rb b/app/controllers/api/v1/logins_controller.rb new file mode 100644 index 00000000..015af7bb --- /dev/null +++ b/app/controllers/api/v1/logins_controller.rb @@ -0,0 +1,14 @@ +module Api + module V1 + class LoginsController < ApplicationController + def create + @user = User.find_by_email(params[:email]) + if @user.valid_password?(params[:password]) + render json: { auth_token: @user.authentication_token } + else + render json: { auth_token: "" } + end + end + end + end +end |
