Bugfixes for Nova.

This commit is contained in:
Tim Brandin 2016-04-02 21:02:28 +02:00
parent 6acc97f94a
commit ddcca19867
5 changed files with 18 additions and 14 deletions

View file

@ -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);
}
}
```

View file

@ -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.');
}

View file

@ -8,7 +8,7 @@ export class Button extends React.Component {
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
}
return <button className={ className }
type={type} 
type={ type } 
disabled={ disabled }
onClick={ onClick }>{ label }</button>;
}

View file

@ -9,11 +9,15 @@ import './SocialButtons.jsx';
export class Form extends React.Component {
componentDidMount() {
let node = ReactDOM.findDOMNode(this);
console.log(node);
if (node) {
node.addEventListener('submit', (e) => {
e.preventDefault();
});
}
}
render() {
const {

View file

@ -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);
}
}