Unverified Commit 1f07b9a1 authored by Ibrahim Serdar Acikgoz's avatar Ibrahim Serdar Acikgoz Committed by GitHub
Browse files

[MM-26533] signup: add redirect to verifaction link (#5841)

* signup: add redirect to verifaction link

* update mattermost-redux dependency
parent 1793584a
......@@ -119,6 +119,7 @@ export default class SignupEmail extends React.PureComponent {
handleSignupSuccess = (user, data) => {
trackEvent('signup', 'signup_user_02_complete');
const redirectTo = (new URLSearchParams(this.props.location.search)).get('redirect_to');
this.props.actions.loginById(data.id, user.password, '').then(({error}) => {
if (error) {
......@@ -127,6 +128,9 @@ export default class SignupEmail extends React.PureComponent {
if (this.state.teamName) {
verifyUrl += '&teamname=' + encodeURIComponent(this.state.teamName);
}
if (redirectTo) {
verifyUrl += '&redirect_to=' + redirectTo;
}
browserHistory.push(verifyUrl);
} else {
this.setState({
......@@ -142,7 +146,6 @@ export default class SignupEmail extends React.PureComponent {
this.props.actions.setGlobalItem(this.state.token, JSON.stringify({usedBefore: true}));
}
const redirectTo = (new URLSearchParams(this.props.location.search)).get('redirect_to');
if (redirectTo) {
browserHistory.push(redirectTo);
} else {
......@@ -251,7 +254,9 @@ export default class SignupEmail extends React.PureComponent {
allow_marketing: true,
};
this.props.actions.createUser(user, this.state.token, this.state.inviteId).then((result) => {
const redirectTo = (new URLSearchParams(this.props.location.search)).get('redirect_to');
this.props.actions.createUser(user, this.state.token, this.state.inviteId, redirectTo).then((result) => {
if (result.error) {
this.setState({
serverError: result.error.message,
......
......@@ -18109,8 +18109,8 @@
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#8b003ea1aa10bf64b306a006e8a0ed7477924704",
"from": "github:mattermost/mattermost-redux#8b003ea1aa10bf64b306a006e8a0ed7477924704",
"version": "github:mattermost/mattermost-redux#97fd99c0b617831bba22c406bc7ab45239a0dd8f",
"from": "github:mattermost/mattermost-redux#97fd99c0b617831bba22c406bc7ab45239a0dd8f",
"requires": {
"core-js": "3.6.4",
"form-data": "3.0.0",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment