stormpath / stormpath-express-react-example

Fullstack example application, using React, Express.js, and Stormpath
Apache License 2.0
106 stars 43 forks source link

'Required' bug -- kinda interesting #29

Closed mdeggies closed 7 years ago

mdeggies commented 7 years ago

Customer reported bug.

Clone the example project. Add the following to the Stormpath config section in server.js:

   ....
   register: {
      form: {
        fields: {
          phone: {
            enabled: true,
            label: 'Phone',
            required: true,
            placeholder: 'Phone',
            type: 'text'
          }
        }
      }
    }
  },
  ....

Add the following to RegisterPage.js below one of the other fields (like email):

                    <div className="form-group">
                      <label htmlFor="customData.phone" className="col-xs-12 col-sm-4 control-label">Phone</label>
                      <div className="col-xs-12 col-sm-4">
                        <input type="text" className="form-control" id="customData.phone" name="customData.phone" placeholder="888-888-8888" required={ true } />
                      </div>
                    </div>

Run the project, open dev tools, go to /register, try to create an account. You'll get POST http://localhost:3000/register 400 (Bad Request)

Next, remove required: true from server.js and make the same request. The request goes through just fine.