Client connection and IP in Accounts.onCreateUser


Hey - I’m trying to validate a captcha from a signup form and I would like to so within Accounts.onCreateUser (this is where it makes the most sense to me anyway).

Thing is, I’m not sure how to retrieve the user IP address. Too bad since validateLoginAttempt does expose connection I don’t understand why onCreateUser doesn’t do the same…


Were you able to figure something out for this?


Yes, but not really proud of what I did. Essentially, I have to call a method getUserIP from the client that retrieves the user IP address with this.connection.clientAddress, and then pass the result to Account.createUser({username, email, password, captcha: {value, remoteip}).

This is a bit stupid since this makes two method calls to the server, but I don’t have any other idea atm…


In Meteor version 1.5.2 inside Accounts.onCreateUser(function(options, user) { ... });
this.connection is undefined