Skip to content

Commit

Permalink
Pass custom success/error function on user creation through config (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao1 authored Feb 20, 2024
1 parent b26cc6e commit 531935f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,15 @@ var UserCreationApplication = $n2.Class({
,token: null

,userAgreementDoc: null

,redirectFunction: null

,initialize: function(opts_){
var opts = $n2.extend({
config: null
,div: null
,token: null
,redirectFunction: null
},opts_);

var _this = this;
Expand Down Expand Up @@ -458,6 +461,8 @@ var UserCreationApplication = $n2.Class({
this.divId = $n2.getUniqueId();
$( opts.div ).attr('id',this.divId);
};

this.redirectFunction = opts.redirectFunction

var $display = this._getDiv();
$display.empty();
Expand Down Expand Up @@ -919,13 +924,16 @@ var UserCreationApplication = $n2.Class({
.text(link)
.appendTo($redirect);

let redirect = redirectToMainSite
if (this.redirectFunction) redirect = this.redirectFunction

// Log in user
if( this.authService ){
this.authService.login({
username: emailAdress
,password: password
,onSuccess: redirectToMainSite
,onError: redirectToMainSite
,onSuccess: redirect
,onError: redirect
});
};

Expand Down

0 comments on commit 531935f

Please sign in to comment.