mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
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:
parent
ff0dc79546
commit
a79bbd686f
2 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ var UserModel = BaseModel.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.get('website').length) {
|
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)) {
|
!validator.isLength(this.get('website'), 0, 2000)) {
|
||||||
validationErrors.push({message: "Please use a valid url"});
|
validationErrors.push({message: "Please use a valid url"});
|
||||||
}
|
}
|
||||||
|
@ -121,4 +121,4 @@ var UserModel = BaseModel.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default UserModel;
|
export default UserModel;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="user-website">Website</label>
|
<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>
|
<p>Have a website or blog other than this one? Link it!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue