summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/account/ProfileView.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib/account/ProfileView.js')
-rwxr-xr-xStoneIsland/www/js/lib/account/ProfileView.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/StoneIsland/www/js/lib/account/ProfileView.js b/StoneIsland/www/js/lib/account/ProfileView.js
index ee39374b..a4e06791 100755
--- a/StoneIsland/www/js/lib/account/ProfileView.js
+++ b/StoneIsland/www/js/lib/account/ProfileView.js
@@ -21,6 +21,8 @@ var ProfileView = FormView.extend({
app.closed.setMessage("PLEASE GO ONLINE TO<br>EDIT YOUR PROFILE.", "")
return
}
+ if (! auth.user) return
+ app.account.consent.check()
app.footer.show("SAVE")
document.body.className = "profile"
if (auth.user.BirthDay.match(/T/)) {
@@ -47,6 +49,7 @@ var ProfileView = FormView.extend({
"Name": "Please enter your first name.",
"Surname": "Please enter your last name.",
"Email": "Please enter a valid email address.",
+ "BirthDay": "Please your birthday.",
},
validate_fields: function(data, errors){
@@ -54,7 +57,14 @@ var ProfileView = FormView.extend({
if (! data.CurrentPassword && (data.NewPassword || data.Email !== auth.user.Email)) { errors.push([ "CurrentPassword", "Please enter your current password." ]) }
if (data.CurrentPassword && ! data.NewPassword) { errors.push([ "NewPassword", "Please enter your new password." ]) }
if (data.NewPassword && data.NewPassword.length < 7) { errors.push([ "CurrentPassword", "New password must be 7 characters or more." ]) }
- if (! data.Birthday) data.BirthDay = '1900-01-01'
+ var now = new Date ()
+ var year = now.getFullYear()
+ if (! data.BirthDay) data.BirthDay = year + '-01-01'
+ if (data.BirthDay.split('-')[0] || '2018')
+ var birthday = new Date (data.BirthDay)
+ if (isNaN(birthday) || (now - birthday) / (365*24*60*60*1000) < 18) {
+ errors.push(['BirthDay', 'You must be 18 or older to use the Stone Island app.'])
+ }
// if (data.Gender === "NONE") { errors.push([ "Gender", "Please supply your gender." ]) }
},