Fixing broken signup page
Этот коммит содержится в:
@@ -20,8 +20,6 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
initialState.user = {};
|
initialState.user = {};
|
||||||
initialState.user.team_id = this.props.teamId;
|
initialState.user.team_id = this.props.teamId;
|
||||||
initialState.user.email = this.props.email;
|
initialState.user.email = this.props.email;
|
||||||
initialState.hash = this.props.hash;
|
|
||||||
initialState.data = this.props.data;
|
|
||||||
initialState.original_email = this.props.email;
|
initialState.original_email = this.props.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +45,7 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const usernameError = Utils.isValidUsername(this.state.user.username);
|
const usernameError = Utils.isValidUsername(providedUsername);
|
||||||
if (usernameError === 'Cannot use a reserved word as a username.') {
|
if (usernameError === 'Cannot use a reserved word as a username.') {
|
||||||
this.setState({nameError: 'This username is reserved, please choose a new one.', emailError: '', passwordError: '', serverError: ''});
|
this.setState({nameError: 'This username is reserved, please choose a new one.', emailError: '', passwordError: '', serverError: ''});
|
||||||
return;
|
return;
|
||||||
@@ -67,26 +65,29 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const user = {
|
||||||
|
team_id: this.props.teamId,
|
||||||
|
email: providedEmail,
|
||||||
|
username: providedUsername,
|
||||||
|
password: providedPassword,
|
||||||
|
allow_marketing: true
|
||||||
|
};
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
user: {
|
user,
|
||||||
email: providedEmail,
|
|
||||||
username: providedUsername,
|
|
||||||
password: providedPassword,
|
|
||||||
allow_marketing: true
|
|
||||||
},
|
|
||||||
nameError: '',
|
nameError: '',
|
||||||
emailError: '',
|
emailError: '',
|
||||||
passwordError: '',
|
passwordError: '',
|
||||||
serverError: ''
|
serverError: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
client.createUser(this.state.user, this.state.data, this.state.hash,
|
client.createUser(user, this.props.data, this.props.hash,
|
||||||
function createUserSuccess() {
|
function createUserSuccess() {
|
||||||
client.track('signup', 'signup_user_02_complete');
|
client.track('signup', 'signup_user_02_complete');
|
||||||
|
|
||||||
client.loginByEmail(this.props.teamName, this.state.user.email, this.state.user.password,
|
client.loginByEmail(this.props.teamName, user.email, user.password,
|
||||||
function emailLoginSuccess(data) {
|
function emailLoginSuccess(data) {
|
||||||
UserStore.setLastEmail(this.state.user.email);
|
UserStore.setLastEmail(user.email);
|
||||||
UserStore.setCurrentUser(data);
|
UserStore.setCurrentUser(data);
|
||||||
if (this.props.hash > 0) {
|
if (this.props.hash > 0) {
|
||||||
BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'}));
|
BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'}));
|
||||||
@@ -95,7 +96,7 @@ export default class SignupUserComplete extends React.Component {
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
function emailLoginFailure(err) {
|
function emailLoginFailure(err) {
|
||||||
if (err.message === 'Login failed because email address has not been verified') {
|
if (err.message === 'Login failed because email address has not been verified') {
|
||||||
window.location.href = '/verify_email?email=' + encodeURIComponent(this.state.user.email) + '&teamname=' + encodeURIComponent(this.props.teamName);
|
window.location.href = '/verify_email?email=' + encodeURIComponent(user.email) + '&teamname=' + encodeURIComponent(this.props.teamName);
|
||||||
} else {
|
} else {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user