mirror of
https://github.com/vale981/accounts-ui
synced 2025-03-05 18:01:39 -05:00
Bugfixes for Nova.
This commit is contained in:
parent
6acc97f94a
commit
ddcca19867
5 changed files with 18 additions and 14 deletions
|
@ -374,14 +374,14 @@ class NewLogin extends Accounts.ui.LoginForm {
|
||||||
return super.fields();
|
return super.fields();
|
||||||
}
|
}
|
||||||
|
|
||||||
signUp(event, options = {}) {
|
signUp(options = {}) {
|
||||||
const { firstname = null } = this.state;
|
const { firstname = null } = this.state;
|
||||||
if (firstname !== null) {
|
if (firstname !== null) {
|
||||||
options.profile = Object.assign(options.profile || {}, {
|
options.profile = Object.assign(options.profile || {}, {
|
||||||
firstname: firstname
|
firstname: firstname
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
super.signUp(event, options);
|
super.signUp(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,5 +7,5 @@ try {
|
||||||
return user;
|
return user;
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} 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.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ export class Button extends React.Component {
|
||||||
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
|
return <a href={ href } className={ className } onClick={ onClick }>{ label }</a>;
|
||||||
}
|
}
|
||||||
return <button className={ className }
|
return <button className={ className }
|
||||||
type={type}
|
type={ type }
|
||||||
disabled={ disabled }
|
disabled={ disabled }
|
||||||
onClick={ onClick }>{ label }</button>;
|
onClick={ onClick }>{ label }</button>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,15 @@ import './SocialButtons.jsx';
|
||||||
|
|
||||||
export class Form extends React.Component {
|
export class Form extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
let node = ReactDOM.findDOMNode(this);
|
let node = ReactDOM.findDOMNode(this);
|
||||||
|
console.log(node);
|
||||||
|
if (node) {
|
||||||
node.addEventListener('submit', (e) => {
|
node.addEventListener('submit', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -301,7 +301,7 @@ export class LoginForm extends Tracker.Component {
|
||||||
type: hasPasswordService() ? 'submit' : 'link',
|
type: hasPasswordService() ? 'submit' : 'link',
|
||||||
className: 'active',
|
className: 'active',
|
||||||
disabled: waiting,
|
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 {
|
const {
|
||||||
username = null,
|
username = null,
|
||||||
email = null,
|
email = null,
|
||||||
|
@ -563,8 +563,8 @@ export class LoginForm extends Tracker.Component {
|
||||||
|
|
||||||
this.setState({waiting: true});
|
this.setState({waiting: true});
|
||||||
|
|
||||||
const SignUp = () => {
|
const SignUp = function(_options) {
|
||||||
Accounts.createUser(options, (error) => {
|
Accounts.createUser(_options, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error');
|
this.showMessage(T9n.get(`error.accounts.${error.reason}`) || T9n.get("Unknown error"), 'error');
|
||||||
if (T9n.get(`error.accounts.${error.reason}`)) {
|
if (T9n.get(`error.accounts.${error.reason}`)) {
|
||||||
|
@ -581,7 +581,7 @@ export class LoginForm extends Tracker.Component {
|
||||||
password: null
|
password: null
|
||||||
});
|
});
|
||||||
let user = Accounts.user();
|
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 });
|
this.setState({ waiting: false });
|
||||||
|
@ -591,10 +591,10 @@ export class LoginForm extends Tracker.Component {
|
||||||
// Allow for Promises to return.
|
// Allow for Promises to return.
|
||||||
let promise = Accounts.ui._options.onPreSignUpHook(options);
|
let promise = Accounts.ui._options.onPreSignUpHook(options);
|
||||||
if (promise instanceof Promise) {
|
if (promise instanceof Promise) {
|
||||||
promise.then(SignUp);
|
promise.then(SignUp.bind(this, options));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SignUp();
|
SignUp(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue