mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +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(){
|
||||
|
||||
$('#submitBtn').on('click',function(){
|
||||
alert('click');
|
||||
|
||||
var userData = {
|
||||
uid:$('#inputUID').val(),
|
||||
email:$('#inputEmail').val(),
|
||||
@@ -89,7 +89,7 @@
|
||||
$.post('/edituser',
|
||||
userData,
|
||||
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) {
|
||||
User.setUserField(uid, key, data[key]);
|
||||
var fields = ['email', 'fullname', 'website', 'location', 'birthday'];
|
||||
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)
|
||||
return res.redirect('/');
|
||||
|
||||
user.updateUserFields(req.user.uid, req.body);
|
||||
user.updateProfile(req.user.uid, req.body);
|
||||
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user