mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
changed user update profile so that it only updates specific fields, before it was possible to send in rep,post count
This commit is contained in:
@@ -76,7 +76,7 @@
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('#submitBtn').on('click',function(){
|
$('#submitBtn').on('click',function(){
|
||||||
alert('click');
|
|
||||||
var userData = {
|
var userData = {
|
||||||
uid:$('#inputUID').val(),
|
uid:$('#inputUID').val(),
|
||||||
email:$('#inputEmail').val(),
|
email:$('#inputEmail').val(),
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
$.post('/edituser',
|
$.post('/edituser',
|
||||||
userData,
|
userData,
|
||||||
function(data) {
|
function(data) {
|
||||||
alert('fail');
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
11
src/user.js
11
src/user.js
@@ -70,10 +70,15 @@ var config = require('../config.js'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
User.updateUserFields = function(uid, data) {
|
User.updateProfile = function(uid, data) {
|
||||||
|
|
||||||
for(var key in data) {
|
var fields = ['email', 'fullname', 'website', 'location', 'birthday'];
|
||||||
User.setUserField(uid, key, data[key]);
|
var key = '';
|
||||||
|
|
||||||
|
for(var i=0,ii=fields.length; i<ii; ++i) {
|
||||||
|
key = fields[i];
|
||||||
|
if(data[key] !== undefined)
|
||||||
|
User.setUserField(uid, key, data[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ var express = require('express'),
|
|||||||
if(req.user.uid != req.body.uid)
|
if(req.user.uid != req.body.uid)
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
|
|
||||||
user.updateUserFields(req.user.uid, req.body);
|
user.updateProfile(req.user.uid, req.body);
|
||||||
|
|
||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user