summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-22 10:33:21 +0100
committerAzul <azul@leap.se>2012-11-22 10:33:21 +0100
commit7e5db2a28ba872154e5f5002bb84d149a512e36e (patch)
tree81f49487672fe7302c0e3f8a67adc40d37b96393 /users
parenta8cefdcb896736608fcd94456b8f42c8aafd8d7f (diff)
using the new srp.js api
Diffstat (limited to 'users')
m---------users/app/assets/javascripts/srp0
-rw-r--r--users/app/assets/javascripts/users.js.coffee20
-rw-r--r--users/app/controllers/sessions_controller.rb4
3 files changed, 13 insertions, 11 deletions
diff --git a/users/app/assets/javascripts/srp b/users/app/assets/javascripts/srp
-Subproject efac662cdf31bc4b61ffb97b8c398e22a86c364
+Subproject 635ea47f1c19d7985a8f5107c070ae19edf9dd5
diff --git a/users/app/assets/javascripts/users.js.coffee b/users/app/assets/javascripts/users.js.coffee
index ab437f6..75440ea 100644
--- a/users/app/assets/javascripts/users.js.coffee
+++ b/users/app/assets/javascripts/users.js.coffee
@@ -27,21 +27,21 @@ validOrAbort = (event) ->
abortIfErrors()
-signup = (event) ->
- srp = new SRP(jqueryRest())
- srp.register ->
- window.location = '/'
-login = (event) ->
- srp = new SRP(jqueryRest())
- srp.identify ->
- window.location = '/'
+srp.session = new srp.Session()
+srp.signedUp = ->
+ window.location = '/'
+srp.loggedIn = ->
+ window.location = '/'
+
+srp.error = (message) ->
+ alert(message)
$(document).ready ->
$('#new_user').submit preventDefault
$('#new_user').submit validOrAbort
- $('#new_user').submit signup
+ $('#new_user').submit srp.signup
$('#new_session').submit preventDefault
- $('#new_session').submit login
+ $('#new_session').submit srp.login
diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb
index 486f67e..66c1c4f 100644
--- a/users/app/controllers/sessions_controller.rb
+++ b/users/app/controllers/sessions_controller.rb
@@ -3,7 +3,9 @@ class SessionsController < ApplicationController
skip_before_filter :verify_authenticity_token
def new
- @errors = authentication_error
+ if @errors = authentication_error
+ render :status => 422
+ end
end
def create