signature work

v1.18.x
Baris Soner Usakli 12 years ago
parent 47d491b266
commit 9c5fa5fc5e

@ -713,6 +713,13 @@ body .navbar .nodebb-inline-block {
}
.post-signature {
color:#666;
font-size:12px;
color: #666;
font-size: 12px;
border-top: 1px solid #ddd;
display: inline-block;
img {
max-width:200px;
max-height:60px;
}
}

@ -120,7 +120,7 @@
<div class="control-group">
<label class="control-label" for="inputSignature">Signature</label>
<div class="controls">
<textarea id="inputSignature" placeholder="your signature" rows="5">{signature}</textarea>
<textarea id="inputSignature" placeholder="max 150 chars" rows="5">{signature}</textarea>
</div>
</div>
@ -248,7 +248,18 @@ $(document).ready(function() {
$.post('/users/doedit',
userData,
function(data) {
app.alert({
if(data.error) {
app.alert({
'alert_id': 'user_profile_updated',
type: 'error',
title: 'Profile Update Error',
message: data.error,
timeout: 2000
});
return;
}
app.alert({
'alert_id': 'user_profile_updated',
type: 'success',
title: 'Profile Updated',

@ -45,7 +45,7 @@ marked.setOptions({
'username' : user_data[uid].username || 'anonymous',
'user_rep' : user_data[uid].reputation || 0,
'gravatar' : user_data[uid].picture || 'http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e',
'signature' : user_data[uid].signature,
'signature' : marked(utils.strip_tags(user_data[uid].signature || '')),
'fav_star_class' : vote_data[pid] ? 'icon-star' : 'icon-star-empty',
'display_moderator_tools': (uid == current_user || privileges.editable) ? 'show' : 'none',
'edited-class': post_data.editor[i] !== null ? '' : 'none',

@ -82,9 +82,9 @@ var user = require('./../user.js'),
return res.redirect('/');
}
user.updateProfile(req.user.uid, req.body);
res.send({});
user.updateProfile(req.user.uid, req.body, function(data) {
res.send(data);
});
});
app.post('/users/uploadpicture', function(req, res) {

@ -79,11 +79,18 @@ var config = require('../config.js'),
});
}
User.updateProfile = function(uid, data) {
User.updateProfile = function(uid, data, callback) {
var fields = ['email', 'fullname', 'website', 'location', 'birthday', 'signature'];
var key = '';
if(data['signature'] !== undefined && data['signature'].length > 150)
{
callback({error:'Signature can\'t be longer than 150 characters!'});
return;
}
for(var i=0,ii=fields.length; i<ii; ++i) {
key = fields[i];
@ -93,16 +100,16 @@ var config = require('../config.js'),
User.setUserField(uid, 'gravatarpicture', User.createGravatarURLFromEmail(data[key]));
RDB.set('email:' + data['email'] +':uid', uid);
}
else if(key === 'signature') {
//sanitize sig plx - baris
//data[key] = marked(data[key]);
}
User.setUserField(uid, key, data[key]);
}
}
callback({});
}
User.setUserField = function(uid, field, value) {
RDB.hset('user:'+uid, field, value);
}

Loading…
Cancel
Save