Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@ AT.prototype.postSubmitRedirect = function(route){
};

AT.prototype.submitCallback = function(error, state, onSuccess){

var onSubmitHook = AccountsTemplates.options.onSubmitHook;
if(onSubmitHook)
onSubmitHook(error, state);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it risky to have this at the begin?
What if someone put a Router.go inside it?
...not sure, but the following should be executed anyhow, right?


if (error) {
if(_.isObject(error.details))
// If error.details is an object, we may try to set fields errors from it
Expand All @@ -482,7 +487,8 @@ AT.prototype.submitCallback = function(error, state, onSuccess){
}
else{
if (onSuccess)
onSuccess();
onSuccess()

if (_.contains(["enrollAccount", "forgotPwd", "resetPwd", "verifyEmail"], state)){
var redirectTimeout = AccountsTemplates.options.redirectTimeout;
if (redirectTimeout > 0)
Expand Down
6 changes: 6 additions & 0 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ CONFIG_PAT = {
homeRoutePath: Match.Optional(String),
redirectTimeout: Match.Optional(Number),

// Hooks
onSubmitHook: Match.Optional(Function),

texts: Match.Optional(TEXTS_PAT),
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default was changed to "default" with #199
...haven't tested it yet though

Expand Down Expand Up @@ -268,6 +271,9 @@ AT.prototype.options = {
// Redirects
homeRoutePath: "/",
redirectTimeout: 2000, // 2 seconds

// Hooks
onSubmitHook: undefined,
};

AT.prototype.SPECIAL_FIELDS = [
Expand Down