Reformatted team_signup_password_page.jsx to meet style guide requirements.

Этот коммит содержится в:
JoramWilander
2015-08-31 10:17:28 -04:00
родитель 72575ac7bd
Коммит eb80b96641

Просмотреть файл

@@ -1,21 +1,25 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information. // See License.txt for license information.
var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx'); var client = require('../utils/client.jsx');
var BrowserStore = require('../stores/browser_store.jsx');
var UserStore = require('../stores/user_store.jsx');
module.exports = React.createClass({ export default class TeamSignupPasswordPage extends React.Component {
displayName: 'TeamSignupPasswordPage', constructor(props) {
propTypes: { super(props);
state: React.PropTypes.object,
updateParent: React.PropTypes.func this.submitBack = this.submitBack.bind(this);
}, this.submitNext = this.submitNext.bind(this);
submitBack: function(e) {
this.state = {};
}
submitBack(e) {
e.preventDefault(); e.preventDefault();
this.props.state.wizard = 'username'; this.props.state.wizard = 'username';
this.props.updateParent(this.props.state); this.props.updateParent(this.props.state);
}, }
submitNext: function(e) { submitNext(e) {
e.preventDefault(); e.preventDefault();
var password = this.refs.password.getDOMNode().value.trim(); var password = this.refs.password.getDOMNode().value.trim();
@@ -37,9 +41,8 @@ module.exports = React.createClass({
var props = this.props; var props = this.props;
client.loginByEmail(teamSignup.team.name, teamSignup.team.email, teamSignup.user.password, client.loginByEmail(teamSignup.team.name, teamSignup.team.email, teamSignup.user.password,
function(data) { function loginSuccess() {
UserStore.setLastEmail(teamSignup.team.email); UserStore.setLastEmail(teamSignup.team.email);
UserStore.setCurrentUser(teamSignup.user); UserStore.setCurrentUser(teamSignup.user);
if (this.props.hash > 0) { if (this.props.hash > 0) {
@@ -52,7 +55,7 @@ module.exports = React.createClass({
window.location.href = '/'; window.location.href = '/';
}.bind(this), }.bind(this),
function(err) { function loginFail(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(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name); window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name);
} else { } else {
@@ -67,11 +70,8 @@ module.exports = React.createClass({
$('#finish-button').button('reset'); $('#finish-button').button('reset');
}.bind(this) }.bind(this)
); );
}, }
getInitialState: function() { render() {
return {};
},
render: function() {
client.track('signup', 'signup_team_07_password'); client.track('signup', 'signup_team_07_password');
var passwordError = null; var passwordError = null;
@@ -89,7 +89,10 @@ module.exports = React.createClass({
return ( return (
<div> <div>
<form> <form>
<img className='signup-team-logo' src='/static/images/logo.png' /> <img
className='signup-team-logo'
src='/static/images/logo.png'
/>
<h2 className='margin--less'>Your password</h2> <h2 className='margin--less'>Your password</h2>
<h5 className='color--light'>Select a password that you'll use to login with your email address:</h5> <h5 className='color--light'>Select a password that you'll use to login with your email address:</h5>
<div className='inner__content margin--extra'> <div className='inner__content margin--extra'>
@@ -99,7 +102,14 @@ module.exports = React.createClass({
<div className='row'> <div className='row'>
<div className='col-sm-11'> <div className='col-sm-11'>
<h5><strong>Choose your password</strong></h5> <h5><strong>Choose your password</strong></h5>
<input autoFocus={true} type='password' ref='password' className='form-control' placeholder='' maxLength='128' /> <input
autoFocus={true}
type='password'
ref='password'
className='form-control'
placeholder=''
maxLength='128'
/>
<div className='color--light form__hint'>Passwords must contain 5 to 50 characters. Your password will be strongest if it contains a mix of symbols, numbers, and upper and lowercase characters.</div> <div className='color--light form__hint'>Passwords must contain 5 to 50 characters. Your password will be strongest if it contains a mix of symbols, numbers, and upper and lowercase characters.</div>
</div> </div>
</div> </div>
@@ -108,14 +118,37 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
<div className='form-group'> <div className='form-group'>
<button type='submit' className='btn btn-primary margin--extra' id='finish-button' data-loading-text={'<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> Creating ' + strings.Team + '...'} onClick={this.submitNext}>Finish</button> <button
type='submit'
className='btn btn-primary margin--extra'
id='finish-button'
data-loading-text={'<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> Creating ' + strings.Team + '...'}
onClick={this.submitNext}
>
Finish
</button>
</div> </div>
<p>By proceeding to create your account and use {config.SiteName}, you agree to our <a href={config.TermsLink}>Terms of Service</a> and <a href={config.PrivacyLink}>Privacy Policy</a>. If you do not agree, you cannot use {config.SiteName}.</p> <p>By proceeding to create your account and use {config.SiteName}, you agree to our <a href={config.TermsLink}>Terms of Service</a> and <a href={config.PrivacyLink}>Privacy Policy</a>. If you do not agree, you cannot use {config.SiteName}.</p>
<div className='margin--extra'> <div className='margin--extra'>
<a href='#' onClick={this.submitBack}>Back to previous step</a> <a
href='#'
onClick={this.submitBack}
>
Back to previous step
</a>
</div> </div>
</form> </form>
</div> </div>
); );
} }
}); }
TeamSignupPasswordPage.defaultProps = {
state: {},
hash: ''
};
TeamSignupPasswordPage.propTypes = {
state: React.PropTypes.object,
hash: React.PropTypes.string,
updateParent: React.PropTypes.func
};