diff --git a/README.md b/README.md index 4e2eb3e..0fc27d7 100644 --- a/README.md +++ b/README.md @@ -374,14 +374,14 @@ class NewLogin extends Accounts.ui.LoginForm { return super.fields(); } - signUp(event, options = {}) { + signUp(options = {}) { const { firstname = null } = this.state; if (firstname !== null) { options.profile = Object.assign(options.profile || {}, { firstname: firstname }); } - super.signUp(event, options); + super.signUp(options); } } ``` diff --git a/imports/api/server/onPostSignUpHook.js b/imports/api/server/onPostSignUpHook.js index 8002642..b286a4d 100644 --- a/imports/api/server/onPostSignUpHook.js +++ b/imports/api/server/onPostSignUpHook.js @@ -7,5 +7,5 @@ try { return user; }); } catch(e) { - console.log('You\'ve implemented Accounts.onCreateUser elsewhere in your application, you can therefor not us Accounts.ui.config({ onPostSignUpHook }) on the server.'); + console.log('You\'ve implemented Accounts.onCreateUser elsewhere in your application, you can therefor not use Accounts.ui.config({ onPostSignUpHook }) on the server.'); } diff --git a/imports/ui/components/Button.jsx b/imports/ui/components/Button.jsx index 4e80e10..7c02fd1 100644 --- a/imports/ui/components/Button.jsx +++ b/imports/ui/components/Button.jsx @@ -8,7 +8,7 @@ export class Button extends React.Component { return { label }; } return ; } diff --git a/imports/ui/components/Form.jsx b/imports/ui/components/Form.jsx index a93db34..8248666 100644 --- a/imports/ui/components/Form.jsx +++ b/imports/ui/components/Form.jsx @@ -9,10 +9,14 @@ import './SocialButtons.jsx'; export class Form extends React.Component { componentDidMount() { + let node = ReactDOM.findDOMNode(this); - node.addEventListener('submit', (e) => { - e.preventDefault(); - }); + console.log(node); + if (node) { + node.addEventListener('submit', (e) => { + e.preventDefault(); + }); + } } render() { diff --git a/imports/ui/components/LoginForm.jsx b/imports/ui/components/LoginForm.jsx index e14761a..6ed4869 100644 --- a/imports/ui/components/LoginForm.jsx +++ b/imports/ui/components/LoginForm.jsx @@ -301,7 +301,7 @@ export class LoginForm extends Tracker.Component { type: hasPasswordService() ? 'submit' : 'link', className: 'active', disabled: waiting, - onClick: hasPasswordService() ? this.signUp.bind(this) : null + onClick: hasPasswordService() ? this.signUp.bind(this, {}) : null }); } @@ -510,7 +510,7 @@ export class LoginForm extends Tracker.Component { } - signUp(event, options = {}) { + signUp(options = {}) { const { username = null, email = null, @@ -563,8 +563,8 @@ export class LoginForm extends Tracker.Component { this.setState({waiting: true}); - const SignUp = () => { - Accounts.createUser(options, (error) => { + const SignUp = function(_options) { + Accounts.createUser(_options, (error) => { if (error) { this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error'); if (T9n.get(`error.accounts.${error.reason}`)) { @@ -581,7 +581,7 @@ export class LoginForm extends Tracker.Component { password: null }); let user = Accounts.user(); - loginResultCallback(Accounts.ui._options.onPostSignUpHook.bind(this, options, user)); + loginResultCallback(Accounts.ui._options.onPostSignUpHook.bind(this, _options, user)); } this.setState({ waiting: false }); @@ -591,10 +591,10 @@ export class LoginForm extends Tracker.Component { // Allow for Promises to return. let promise = Accounts.ui._options.onPreSignUpHook(options); if (promise instanceof Promise) { - promise.then(SignUp); + promise.then(SignUp.bind(this, options)); } else { - SignUp(); + SignUp(options); } }