From 33b957ed1a8a44d4bed0f9c674d5602bad5028ea Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Mon, 5 Oct 2015 09:58:42 -0400
Subject: Disabling complexity warning. Allowing non-nested ternary. Upgrading
 ESList. Adding new ESLint rules. Fixing new ESLint errors.

---
 web/react/components/signup_user_complete.jsx | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

(limited to 'web/react/components/signup_user_complete.jsx')

diff --git a/web/react/components/signup_user_complete.jsx b/web/react/components/signup_user_complete.jsx
index 495159efc..ae3075495 100644
--- a/web/react/components/signup_user_complete.jsx
+++ b/web/react/components/signup_user_complete.jsx
@@ -41,15 +41,13 @@ export default class SignupUserComplete extends React.Component {
             return;
         }
 
-        this.state.user.email = providedEmail;
-
-        this.state.user.username = React.findDOMNode(this.refs.name).value.trim().toLowerCase();
-        if (!this.state.user.username) {
+        const providedUsername = React.findDOMNode(this.refs.name).value.trim().toLowerCase();
+        if (!providedUsername) {
             this.setState({nameError: 'This field is required', emailError: '', passwordError: '', serverError: ''});
             return;
         }
 
-        var usernameError = Utils.isValidUsername(this.state.user.username);
+        const usernameError = Utils.isValidUsername(this.state.user.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: ''});
             return;
@@ -63,15 +61,24 @@ export default class SignupUserComplete extends React.Component {
             return;
         }
 
-        this.state.user.password = React.findDOMNode(this.refs.password).value.trim();
-        if (!this.state.user.password || this.state.user.password .length < 5) {
+        const providedPassword = React.findDOMNode(this.refs.password).value.trim();
+        if (!providedPassword || providedPassword.length < 5) {
             this.setState({nameError: '', emailError: '', passwordError: 'Please enter at least 5 characters', serverError: ''});
             return;
         }
 
-        this.setState({nameError: '', emailError: '', passwordError: '', serverError: ''});
-
-        this.state.user.allow_marketing = true;
+        this.setState({
+            user: {
+                email: providedEmail,
+                username: providedUsername,
+                password: providedPassword,
+                allow_marketing: true
+            },
+            nameError: '',
+            emailError: '',
+            passwordError: '',
+            serverError: ''
+        });
 
         client.createUser(this.state.user, this.state.data, this.state.hash,
             function createUserSuccess() {
-- 
cgit v1.2.3-1-g7c22

