summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/account
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib/account')
-rw-r--r--StoneIsland/www/js/lib/account/LoginView.js10
-rw-r--r--StoneIsland/www/js/lib/account/ProfileView.js15
-rw-r--r--StoneIsland/www/js/lib/account/SignupView.js30
3 files changed, 38 insertions, 17 deletions
diff --git a/StoneIsland/www/js/lib/account/LoginView.js b/StoneIsland/www/js/lib/account/LoginView.js
index f1ad3de8..30a4a735 100644
--- a/StoneIsland/www/js/lib/account/LoginView.js
+++ b/StoneIsland/www/js/lib/account/LoginView.js
@@ -5,7 +5,7 @@ var LoginView = SerializableView.extend({
action: sdk.account.login,
events: {
- "click .newuser": "newuser",
+ "click .newuser": "new_user",
"submit form": "save",
},
@@ -21,7 +21,7 @@ var LoginView = SerializableView.extend({
document.body.className = "login"
},
- newuser: function(){
+ new_user: function(){
app.router.go("account/signup")
},
@@ -29,5 +29,11 @@ var LoginView = SerializableView.extend({
"Email": "Please enter a valid email address.",
"Password": "Please enter your password.",
},
+
+ success: function(data){
+ },
+
+ error: function(data){
+ },
})
diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js
index b93dcbc5..892ccbec 100644
--- a/StoneIsland/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/www/js/lib/account/ProfileView.js
@@ -15,7 +15,20 @@ var ProfileView = View.extend({
document.body.className = "profile"
},
- save: function(){
+ validate_presence: {
+ "Name": "Please enter your first name.",
+ "Surname": "Please enter your last name.",
+ "Email": "Please enter a valid email address.",
+ },
+
+ validate_fields: function(errors){
+ if (data.Password && ! data.Password2) { errors.push("Password2", "Please enter your new password.") }
+ },
+
+ success: function(data){
+ },
+
+ error: function(data){
},
}) \ No newline at end of file
diff --git a/StoneIsland/www/js/lib/account/SignupView.js b/StoneIsland/www/js/lib/account/SignupView.js
index e695e26f..616fd9ea 100644
--- a/StoneIsland/www/js/lib/account/SignupView.js
+++ b/StoneIsland/www/js/lib/account/SignupView.js
@@ -2,6 +2,8 @@ var SignupView = SerializableView.extend({
el: "#signup",
+ action: sdk.account.login,
+
events: {
"submit form": "save",
},
@@ -18,25 +20,25 @@ var SignupView = SerializableView.extend({
document.body.className = "signup"
},
- validate: function(data){
- var errors = []
- if (! data.Name) { errors.push("Please enter your first name.") }
- if (! data.Surname) { errors.push("Please enter your last name.") }
- if (! data.Email) { errors.push("Please enter a valid email address.") }
- if (! data.Password) { errors.push("Please enter your password.") }
- if (! data.Password2) { errors.push("Please enter your password again.") }
- if (data.Password !== data.Password2) { errors.push("Passwords don't match.") }
- if (! data.DataProfiling) { errors.push("You must agree to share your data.") }
- return errors
+ validate_presence: {
+ "Name": "Please enter your first name.",
+ "Surname": "Please enter your last name.",
+ "Email": "Please enter a valid email address.",
+ "Password": "Please enter your password.",
+ "Password2": "Please enter your password again.",
+ "DataProfiling": "You must agree to data profiling.",
},
-
- save: function(e){
- e && e.preventDefault()
+
+ validate_fields: function(errors){
+ if (data.Password !== data.Password2) { errors.push("Password2", "Passwords don't match.") }
},
- success: function(){
+ success: function(data){
// change login in ui to logout or whatever
},
+
+ error: function(data){
+ },
/*
var new_user_data = {