diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 3fdb810c83..2455b5101b 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -90,6 +90,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) { userData.status = require('../socket.io').isUserOnline(userData.uid) ? (userData.status || 'online') : 'offline'; userData.banned = parseInt(userData.banned, 10) === 1; userData.website = validator.escape(userData.website); + userData.websiteLink = !userData.website.startsWith('http') ? 'http://' + userData.website : userData.website; userData.websiteName = userData.website.replace(validator.escape('http://'), '').replace(validator.escape('https://'), ''); userData.followingCount = parseInt(userData.followingCount, 10) || 0; userData.followerCount = parseInt(userData.followerCount, 10) || 0; diff --git a/src/user/profile.js b/src/user/profile.js index c5f693cee8..7a3f761edd 100644 --- a/src/user/profile.js +++ b/src/user/profile.js @@ -129,25 +129,6 @@ module.exports = function(User) { return updateFullname(uid, data.fullname, next); } else if (field === 'signature') { data[field] = S(data[field]).stripTags().s; - } else if (field === 'website') { - var urlObj; - if (data[field].length > 0) { - urlObj = url.parse(data[field], false, true); - if (!urlObj.protocol) { - urlObj.protocol = 'http'; - urlObj.slashes = true; - } - if (!urlObj.hostname && urlObj.pathname) { - urlObj.hostname = urlObj.pathname; - urlObj.pathname = null; - } - if (urlObj.pathname === '/') { - urlObj.pathname = null; - } - } - if (urlObj) { - data[field] = url.format(urlObj); - } } User.setUserField(uid, field, data[field], next);