diff options
author | Azul <azul@leap.se> | 2012-12-12 00:09:57 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-12-12 00:09:57 +0100 |
commit | 0871fd8938952d8b718c64d4d45535f7ae9fd742 (patch) | |
tree | ded6504b15bab40b42dd4bd60e4df2571be8bc61 /users/app/controllers/v1 | |
parent | 7a9a4f4e7bd090fd27e05b03f93832d79f5f8db2 (diff) | |
parent | 1a26988cb7ff30061473f4a781166b184b3037ce (diff) |
Merge branch 'master' into develop
Diffstat (limited to 'users/app/controllers/v1')
-rw-r--r-- | users/app/controllers/v1/sessions_controller.rb | 28 | ||||
-rw-r--r-- | users/app/controllers/v1/users_controller.rb | 13 |
2 files changed, 41 insertions, 0 deletions
diff --git a/users/app/controllers/v1/sessions_controller.rb b/users/app/controllers/v1/sessions_controller.rb new file mode 100644 index 0000000..5b4a13b --- /dev/null +++ b/users/app/controllers/v1/sessions_controller.rb @@ -0,0 +1,28 @@ +module V1 + class SessionsController < ApplicationController + + skip_before_filter :verify_authenticity_token + + def new + @session = Session.new + if authentication_errors + @errors = authentication_errors + render :status => 422 + end + end + + def create + authenticate! + end + + def update + authenticate! + render :json => session.delete(:handshake) + end + + def destroy + logout + redirect_to root_path + end + end +end diff --git a/users/app/controllers/v1/users_controller.rb b/users/app/controllers/v1/users_controller.rb new file mode 100644 index 0000000..eda2fad --- /dev/null +++ b/users/app/controllers/v1/users_controller.rb @@ -0,0 +1,13 @@ +module V1 + class UsersController < ApplicationController + + skip_before_filter :verify_authenticity_token, :only => [:create] + + respond_to :json + + def create + @user = User.create(params[:user]) + respond_with @user + end + end +end |