Skip to content

Commit

Permalink
fix socialButtons onLoginHook
Browse files Browse the repository at this point in the history
  • Loading branch information
roy committed May 16, 2018
1 parent 617233b commit 32ab8f3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 0 additions & 6 deletions lib/AccountsReactComponent/methods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ export const createUser = (newUser, callback) => {
export const login = (username, email, password, callback) => {
Meteor.loginWithPassword(username || email, password, err => {
callback(err)
if (!err) {
const { onLoginHook } = AccountsReact.config
if (onLoginHook) {
onLoginHook()
}
}
})
}

Expand Down
9 changes: 8 additions & 1 deletion lib/AccountsReactComponent/signIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class SignIn extends Component {
errors={this.state.errors}
/>

<SocialButtons />
<SocialButtons
defaults={defaults}
/>

{!hideSignUpLink && (
<a className='signIn-link' onMouseDown={this.redirectToSignUp} style={linkStyle} href=''>
Expand Down Expand Up @@ -70,6 +72,11 @@ class SignIn extends Component {
login(username, email, password, err => {
if (err) {
this.setState({ errors: [{ _id: '__globals', errStr: err.reason }] })
} else {
const { onLoginHook } = this.props.defaults
if (onLoginHook) {
onLoginHook()
}
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/AccountsReactComponent/socialButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SocialButtons extends React.Component {
const options = AccountsReact.config.oauth[service] || {}
Meteor['loginWith' + _service](options, err => {
if (!err) {
const { onLoginHook } = AccountsReact.config
const { onLoginHook } = this.props.defaults
if (onLoginHook) {
onLoginHook()
}
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'meteoreact:accounts',
summary: 'Simple and intuative accounts view layer with react',
version: '1.2.0',
version: '1.2.2',
documentation: 'README.md',
git: 'https://github.com/royGil/accounts-react'
})
Expand Down

0 comments on commit 32ab8f3

Please sign in to comment.