mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 16:07:55 +02:00
added about me field
This commit is contained in:
@@ -97,6 +97,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) {
|
||||
userData.fullname = validator.escape(userData.fullname);
|
||||
userData.location = validator.escape(userData.location);
|
||||
userData.signature = validator.escape(userData.signature);
|
||||
userData.aboutme = validator.escape(userData.aboutme || '');
|
||||
|
||||
callback(null, userData);
|
||||
});
|
||||
@@ -154,6 +155,13 @@ accountsController.getAccount = function(req, res, next) {
|
||||
},
|
||||
signature: function(next) {
|
||||
posts.parseSignature(userData, req.uid, next);
|
||||
},
|
||||
aboutme: function(next) {
|
||||
if (userData.aboutme) {
|
||||
plugins.fireHook('filter:parse.raw', userData.aboutme, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}, function(err, results) {
|
||||
if(err) {
|
||||
@@ -163,7 +171,7 @@ accountsController.getAccount = function(req, res, next) {
|
||||
userData.posts = results.posts.posts.filter(function (p) {
|
||||
return p && parseInt(p.deleted, 10) !== 1;
|
||||
});
|
||||
|
||||
userData.aboutme = results.aboutme;
|
||||
userData.nextStart = results.posts.nextStart;
|
||||
userData.isFollowing = results.isFollowing;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.maximumUsernameLength = meta.config.maximumUsernameLength;
|
||||
config.minimumPasswordLength = meta.config.minimumPasswordLength;
|
||||
config.maximumSignatureLength = meta.config.maximumSignatureLength;
|
||||
config.maximumAboutMeLength = meta.config.maximumAboutMeLength;
|
||||
config.useOutgoingLinksPage = parseInt(meta.config.useOutgoingLinksPage, 10) === 1;
|
||||
config.allowGuestSearching = parseInt(meta.config.allowGuestSearching, 10) === 1;
|
||||
config.allowGuestHandles = parseInt(meta.config.allowGuestHandles, 10) === 1;
|
||||
|
||||
@@ -16,7 +16,7 @@ var async = require('async'),
|
||||
module.exports = function(User) {
|
||||
|
||||
User.updateProfile = function(uid, data, callback) {
|
||||
var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature'];
|
||||
var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature', 'aboutme'];
|
||||
|
||||
plugins.fireHook('filter:user.updateProfile', {uid: uid, data: data, fields: fields}, function(err, data) {
|
||||
if (err) {
|
||||
@@ -26,6 +26,14 @@ module.exports = function(User) {
|
||||
fields = data.fields;
|
||||
data = data.data;
|
||||
|
||||
function isAboutMeValid(next) {
|
||||
if (data.aboutme !== undefined && data.aboutme.length > meta.config.maximumAboutMeLength) {
|
||||
next(new Error('[[error:about-me-too-long, ' + meta.config.maximumAboutMeLength + ']]'));
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
function isSignatureValid(next) {
|
||||
if (data.signature !== undefined && data.signature.length > meta.config.maximumSignatureLength) {
|
||||
next(new Error('[[error:signature-too-long, ' + meta.config.maximumSignatureLength + ']]'));
|
||||
@@ -92,7 +100,7 @@ module.exports = function(User) {
|
||||
});
|
||||
}
|
||||
|
||||
async.series([isSignatureValid, isEmailAvailable, isUsernameAvailable], function(err, results) {
|
||||
async.series([isAboutMeValid, isSignatureValid, isEmailAvailable, isUsernameAvailable], function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,10 @@
|
||||
<label>Minimum Password Length</label>
|
||||
<input type="text" class="form-control" value="6" data-field="minimumPasswordLength">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Maximum About Me Length</label>
|
||||
<input type="text" class="form-control" value="500" data-field="maximumAboutMeLength">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Forum Terms of Use <small>(Leave blank to disable)</small></label>
|
||||
<textarea class="form-control" data-field="termsOfUse"></textarea>
|
||||
|
||||
Reference in New Issue
Block a user