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
This commit is contained in:
Steve 2014-05-12 12:07:59 -07:00
parent ff0dc79546
commit a79bbd686f
2 changed files with 3 additions and 3 deletions

View File

@ -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;
export default UserModel;

View File

@ -47,7 +47,7 @@
<div class="form-group">
<label for="user-website">Website</label>
{{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"}}
<p>Have a website or blog other than this one? Link it!</p>
</div>