diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-06-19 09:50:53 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-06-19 09:50:53 -0700 |
commit | e9d7844a9cd4675697a9729e6964ad6c1e8b43d9 (patch) | |
tree | 07432a25e51101d59dc4478f15a42d79afc507ec /web | |
parent | f7bc210f6eea0690853094236568093df01933c8 (diff) | |
download | chat-e9d7844a9cd4675697a9729e6964ad6c1e8b43d9.tar.gz chat-e9d7844a9cd4675697a9729e6964ad6c1e8b43d9.tar.bz2 chat-e9d7844a9cd4675697a9729e6964ad6c1e8b43d9.zip |
Readded error checking for for first and last names but made the requirement a config toggle instead of always required
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/invite_member_modal.jsx | 21 | ||||
-rw-r--r-- | web/static/config/config.js | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx index 8732219fa..0d7e5c3a1 100644 --- a/web/react/components/invite_member_modal.jsx +++ b/web/react/components/invite_member_modal.jsx @@ -28,7 +28,20 @@ module.exports = React.createClass({ if (config.AllowInviteNames) { invite.first_name = this.refs["first_name"+index].getDOMNode().value.trim(); + if (!invite.first_name && config.RequireInviteNames) { + first_name_errors[index] = "This is a required field"; + valid = false; + } else { + first_name_errors[index] = ""; + } + invite.last_name = this.refs["last_name"+index].getDOMNode().value.trim(); + if (!invite.last_name && config.RequireInviteNames) { + last_name_errors[index] = "This is a required field"; + valid = false; + } else { + last_name_errors[index] = ""; + } } invites.push(invite); @@ -101,6 +114,8 @@ module.exports = React.createClass({ for (var i = 0; i < invite_ids.length; i++) { var index = invite_ids[i]; var email_error = this.state.email_errors[index] ? <label className='control-label'>{ this.state.email_errors[index] }</label> : null; + var first_name_error = this.state.first_name_errors[index] ? <label className='control-label'>{ this.state.first_name_errors[index] }</label> : null; + var last_name_error = this.state.last_name_errors[index] ? <label className='control-label'>{ this.state.last_name_errors[index] }</label> : null; invite_sections[index] = ( <div key={"key" + index}> @@ -114,13 +129,15 @@ module.exports = React.createClass({ { email_error } </div> { config.AllowInviteNames ? - <div className={ "form-group invite" }> + <div className={ first_name_error ? "form-group invite has-error" : "form-group invite" }> <input type="text" className="form-control" ref={"first_name"+index} placeholder="First name" maxLength="64" /> + { first_name_error } </div> : "" } { config.AllowInviteNames ? - <div className={ "form-group invite" }> + <div className={ last_name_error ? "form-group invite has-error" : "form-group invite" }> <input type="text" className="form-control" ref={"last_name"+index} placeholder="Last name" maxLength="64" /> + { last_name_error } </div> : "" } </div> diff --git a/web/static/config/config.js b/web/static/config/config.js index 82d4bbf70..45c713da2 100644 --- a/web/static/config/config.js +++ b/web/static/config/config.js @@ -13,6 +13,7 @@ var config = { // Feature switches AllowPublicLink: true, AllowInviteNames: true, + RequireInviteNames: false, AllowSignupDomainsWizard: false, // Privacy switches |