From a79bbd686ff98e3b5eb957b08ac14a61a35454a4 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 12 May 2014 12:07:59 -0700 Subject: [PATCH] Validate user URL input to ensure protocol is present closes #1623 - added protocol validation to isURL on user settings validator. - added placeholder URL to user profile template - ref: https://github.com/sethlilly/Vapor/issues/10 - ref: https://github.com/oswaldoacauan/ghostium/issues/38 --- ghost/admin/models/user.js | 4 ++-- ghost/admin/templates/settings/user.hbs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ghost/admin/models/user.js b/ghost/admin/models/user.js index 71bca56af7..8a081e3d34 100644 --- a/ghost/admin/models/user.js +++ b/ghost/admin/models/user.js @@ -32,7 +32,7 @@ var UserModel = BaseModel.extend({ } if (this.get('website').length) { - if (!validator.isURL(this.get('website')) || + if (!validator.isURL(this.get('website'), { protocols: ['http', 'https'], require_protocol: true }) || !validator.isLength(this.get('website'), 0, 2000)) { validationErrors.push({message: "Please use a valid url"}); } @@ -121,4 +121,4 @@ var UserModel = BaseModel.extend({ } }); -export default UserModel; \ No newline at end of file +export default UserModel; diff --git a/ghost/admin/templates/settings/user.hbs b/ghost/admin/templates/settings/user.hbs index f1ae317616..39d87b60fa 100644 --- a/ghost/admin/templates/settings/user.hbs +++ b/ghost/admin/templates/settings/user.hbs @@ -47,7 +47,7 @@
- {{input type="url" value=user.website id="user-website" autocapitalize="off" autocorrect="off"}} + {{input type="url" value=user.website id="user-website" placeholder="http://www.ghost.org/" autocapitalize="off" autocorrect="off"}}

Have a website or blog other than this one? Link it!