Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign out? #121

Open
AnthonyLamot opened this issue Jun 27, 2017 · 4 comments
Open

Sign out? #121

AnthonyLamot opened this issue Jun 27, 2017 · 4 comments

Comments

@AnthonyLamot
Copy link

This is probably a very basic question, but it's not mentioned in the doc how a logout button can be added.

When using Meteor's accounts, after logging in, the log out button is automatically displayed.

I tried several things but couldn't figure out how to display it. Help much appreciated!

@ianchanning
Copy link

Something doesn't appear to be working - the form should do as you suspect and show the 'profile' information once you are logged in.

If you look at the LoginForm.jsx, the following code is run when you successfully login:

    if (!error) {
      Meteor.loginWithPassword(loginSelector, password, (error, result) => {
        onSubmitHook(error,formState);
        if (error) {
          this.showMessage(`error.accounts.${error.reason}` || "unknown_error", 'error');
        }
        else {
          loginResultCallback(() => this.state.onSignedInHook());
          this.setState({
            formState: STATES.PROFILE,
            password: null,
          });
          this.clearDefaultFieldValues();
        }
      });
}

This sets the state to formState: STATES.PROFILE.

So then the LoginForm should display the Change Password and Sign Out buttons. But for me, the form is blank.

@ianchanning
Copy link

ianchanning commented Aug 1, 2017

And indeed in the LoginFom.jsx buttons() function, there is the following code which should add the Sign Out button:

    if (user && formState == STATES.PROFILE) {
      loginButtons.push({
        id: 'signOut',
        label: this.translate('signOut'),
        disabled: waiting,
        onClick: this.signOut.bind(this)
      });
}

@AnthonyLamot
Copy link
Author

@ianchanning thanks for confirming what I suspected.

In the meantime I've moved on to simply using the Meteor-provided accounts functions to let users sign up / sign in / log out, which I built into forms / buttons of my own making. It seems a more robust approach anyway and you have more control.

Of course, if this package would work it could make building mock-ups a lot faster.

@ianchanning
Copy link

I've essentially worked around the problem by using NavBar buttons instead.

From what I can tell #117 appears to be a related bug and the PR for that looks promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants