mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
closes #3260
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user