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

Disallow to set the state to signup from the console #547

Closed
r3v2d0g opened this issue Sep 24, 2015 · 2 comments
Closed

Disallow to set the state to signup from the console #547

r3v2d0g opened this issue Sep 24, 2015 · 2 comments
Labels

Comments

@r3v2d0g
Copy link

r3v2d0g commented Sep 24, 2015

Hello !

I know that I can disactivate the "signUp" link but the user can still go to the console and type in the console :

AccountsTemplates.setState('signUp');

Is there a way for fix this problem ?

@r3v2d0g
Copy link
Author

r3v2d0g commented Sep 25, 2015

I finally used :

AccountsTemplates.setState = function() {};

@r3v2d0g r3v2d0g closed this as completed Sep 25, 2015
@splendido
Copy link
Member

Well, with AccountsTemplates.configure({forbidClientAccountCreation: true}); you should be able to achieve what you're asking for...

But you're right: there's no filter on the setState method checking the forbidClientAccountCreation configuration options.

I'd say the following should work:

AT.prototype.setState = function(state, callback) {
  check(state, String);

  if (!this._isValidState(state) || (AccountsTemplates.options.forbidClientAccountCreation && state === 'signUp')) {
    throw new Meteor.Error(500, "Internal server error", "accounts-templates-core package got an invalid state value!");
  }

  this.state.form.set("state", state);
  if (!this.avoidClearError) {
    this.clearState();
  }
  this.avoidClearError = false;

  if (_.isFunction(callback)) {
    callback();
  }
};

@splendido splendido reopened this Sep 25, 2015
@splendido splendido added the bug label Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants