summaryrefslogtreecommitdiff
path: root/users/app/controllers/v1/sessions_controller.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-08 16:05:40 +0100
committerAzul <azul@leap.se>2012-12-08 16:05:40 +0100
commit0f36c7931fe04bb3d6a3fd70a25fe1090f48e774 (patch)
tree705212a30f1487787abc8ccf345bc6e0566416e2 /users/app/controllers/v1/sessions_controller.rb
parent8282b83c798ba4e5c1e26ec8243b82669b3ee6d4 (diff)
serve api version 1 in /1/
Just a very simple start for now. Do we want to use the api for the secure remote password auth from js?
Diffstat (limited to 'users/app/controllers/v1/sessions_controller.rb')
-rw-r--r--users/app/controllers/v1/sessions_controller.rb28
1 files changed, 28 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