mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 10:35:55 +01:00 
			
		
		
		
	use uid instead of socket.uid
This commit is contained in:
		| @@ -84,35 +84,38 @@ SocketUser.reset.send = function(socket, email, callback) { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| SocketUser.reset.commit = function(socket, data, callback) { | SocketUser.reset.commit = function(socket, data, callback) { | ||||||
| 	if(data && data.code && data.password) { | 	if (!data || !data.code || !data.password) { | ||||||
| 		async.series([ | 		return callback(new Error('[[error:invalid-data]]')); | ||||||
| 			async.apply(db.getObjectField, 'reset:uid', data.code), |  | ||||||
| 			async.apply(user.reset.commit, data.code, data.password) |  | ||||||
| 		], function(err, data) { |  | ||||||
| 			if (err) { |  | ||||||
| 				return callback(err); |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			var uid = data[0], |  | ||||||
| 				now = new Date(), |  | ||||||
| 				parsedDate = now.getFullYear() + '/' + (now.getMonth()+1) + '/' + now.getDate(); |  | ||||||
|  |  | ||||||
| 			user.getUserField(uid, 'username', function(err, username) { |  | ||||||
| 				emailer.send('reset_notify', uid, { |  | ||||||
| 					username: username, |  | ||||||
| 					date: parsedDate, |  | ||||||
| 					site_title: meta.config.title || 'NodeBB', |  | ||||||
| 					subject: '[[email:reset.notify.subject]]' |  | ||||||
| 				}); |  | ||||||
| 			}); |  | ||||||
| 			events.log({ |  | ||||||
| 				type: 'password-reset', |  | ||||||
| 				uid: socket.uid, |  | ||||||
| 				ip: socket.ip |  | ||||||
| 			}); |  | ||||||
| 			callback(); |  | ||||||
| 		}); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	async.parallel({ | ||||||
|  | 		uid: async.apply(db.getObjectField, 'reset:uid', data.code), | ||||||
|  | 		reset: async.apply(user.reset.commit, data.code, data.password) | ||||||
|  | 	}, function(err, results) { | ||||||
|  | 		if (err) { | ||||||
|  | 			return callback(err); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		var uid = results.uid, | ||||||
|  | 			now = new Date(), | ||||||
|  | 			parsedDate = now.getFullYear() + '/' + (now.getMonth()+1) + '/' + now.getDate(); | ||||||
|  |  | ||||||
|  | 		user.getUserField(uid, 'username', function(err, username) { | ||||||
|  | 			emailer.send('reset_notify', uid, { | ||||||
|  | 				username: username, | ||||||
|  | 				date: parsedDate, | ||||||
|  | 				site_title: meta.config.title || 'NodeBB', | ||||||
|  | 				subject: '[[email:reset.notify.subject]]' | ||||||
|  | 			}); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
|  | 		events.log({ | ||||||
|  | 			type: 'password-reset', | ||||||
|  | 			uid: uid, | ||||||
|  | 			ip: socket.ip | ||||||
|  | 		}); | ||||||
|  | 		callback(); | ||||||
|  | 	}); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| SocketUser.checkStatus = function(socket, uid, callback) { | SocketUser.checkStatus = function(socket, uid, callback) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user