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

Page flash before sign in page with AccountsEntry.signInRequired #341

Open
JoshuaNovak919 opened this issue Jan 12, 2015 · 3 comments
Open

Comments

@JoshuaNovak919
Copy link

I am using AccountsEntry.signInRequired(this) in my route and it works properly, but if I visit a URL I am not allowed to visit I see a quick flash of that page before I get sent to the sign in page. Is there a way to fix this flash?

My code:

Router.route('/dashboard', {
  name: 'dashboard',
  onBeforeAction: function () {
    AccountsEntry.signInRequired(this);
  }
});
@lukeclifton
Copy link

I'm getting this too.

@andrefgneves
Copy link

Same here

@SeabookChen
Copy link

Need to update the code to the below

signInRequired: (router, extraCondition) ->
    extraCondition ?= true
    unless Meteor.loggingIn()
      if not Meteor.user() or not extraCondition
        Session.set('fromWhere', router.url)
        Router.go('/sign-in')
        Session.set('entryError', t9n('error.signInRequired'))
      else
        router.next();

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

4 participants