0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Merge pull request #2734 from shindakun/userurl

Validate user URL input to ensure protocol is present
This commit is contained in:
Hannah Wolfe 2014-05-17 20:22:32 +01:00
commit 1c7a6f4a98
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>