From b013f02209c7c128a35d1c54f2d4a7d6a9701f72 Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Wed, 13 Jan 2016 14:58:49 -0800
Subject: Added ability to sign in via username; separated email sign in and
 sign up config settings

---
 .../components/admin_console/email_settings.jsx    | 84 ++++++++++++++++++++++
 1 file changed, 84 insertions(+)

(limited to 'web/react/components/admin_console/email_settings.jsx')

diff --git a/web/react/components/admin_console/email_settings.jsx b/web/react/components/admin_console/email_settings.jsx
index ce3c8cd12..17f25a04c 100644
--- a/web/react/components/admin_console/email_settings.jsx
+++ b/web/react/components/admin_console/email_settings.jsx
@@ -112,6 +112,8 @@ class EmailSettings extends React.Component {
     buildConfig() {
         var config = this.props.config;
         config.EmailSettings.EnableSignUpWithEmail = ReactDOM.findDOMNode(this.refs.allowSignUpWithEmail).checked;
+        config.EmailSettings.EnableSignInWithEmail = ReactDOM.findDOMNode(this.refs.allowSignInWithEmail).checked;
+        config.EmailSettings.EnableSignInWithUsername = ReactDOM.findDOMNode(this.refs.allowSignInWithUsername).checked;
         config.EmailSettings.SendEmailNotifications = ReactDOM.findDOMNode(this.refs.sendEmailNotifications).checked;
         config.EmailSettings.SendPushNotifications = ReactDOM.findDOMNode(this.refs.sendPushNotifications).checked;
         config.EmailSettings.RequireEmailVerification = ReactDOM.findDOMNode(this.refs.requireEmailVerification).checked;
@@ -317,6 +319,88 @@ class EmailSettings extends React.Component {
                         </div>
                     </div>
 
+                    <div className='form-group'>
+                        <label
+                            className='control-label col-sm-4'
+                            htmlFor='allowSignInWithEmail'
+                        >
+                            <FormattedMessage
+                                id='admin.email.allowEmailSignInTitle'
+                                defaultMessage='Allow Sign In With Email: '
+                            />
+                        </label>
+                        <div className='col-sm-8'>
+                            <label className='radio-inline'>
+                                <input
+                                    type='radio'
+                                    name='allowSignInWithEmail'
+                                    value='true'
+                                    ref='allowSignInWithEmail'
+                                    defaultChecked={this.props.config.EmailSettings.EnableSignInWithEmail}
+                                    onChange={this.handleChange.bind(this, 'allowSignInWithEmail_true')}
+                                />
+                                    {'true'}
+                            </label>
+                            <label className='radio-inline'>
+                                <input
+                                    type='radio'
+                                    name='allowSignInWithEmail'
+                                    value='false'
+                                    defaultChecked={!this.props.config.EmailSettings.EnableSignInWithEmail}
+                                    onChange={this.handleChange.bind(this, 'allowSignInWithEmail_false')}
+                                />
+                                    {'false'}
+                            </label>
+                            <p className='help-text'>
+                                <FormattedMessage
+                                    id='admin.email.allowEmailSignInDescription'
+                                    defaultMessage='When true, Mattermost allows users to sign in using their email and password.'
+                                />
+                            </p>
+                        </div>
+                    </div>
+
+                    <div className='form-group'>
+                        <label
+                            className='control-label col-sm-4'
+                            htmlFor='allowSignInWithUsername'
+                        >
+                            <FormattedMessage
+                                id='admin.email.allowUsernameSignInTitle'
+                                defaultMessage='Allow Sign In With Username: '
+                            />
+                        </label>
+                        <div className='col-sm-8'>
+                            <label className='radio-inline'>
+                                <input
+                                    type='radio'
+                                    name='allowSignInWithUsername'
+                                    value='true'
+                                    ref='allowSignInWithUsername'
+                                    defaultChecked={this.props.config.EmailSettings.EnableSignInWithUsername}
+                                    onChange={this.handleChange.bind(this, 'allowSignInWithUsername_true')}
+                                />
+                                    {'true'}
+                            </label>
+                            <label className='radio-inline'>
+                                <input
+                                    type='radio'
+                                    name='allowSignInWithUsername'
+                                    value='false'
+                                    defaultChecked={!this.props.config.EmailSettings.EnableSignInWithUsername}
+                                    onChange={this.handleChange.bind(this, 'allowSignInWithUsername_false')}
+                                />
+                                    {'false'}
+                            </label>
+                            <p className='help-text'>
+                                <FormattedMessage
+                                    id='admin.email.allowUsernameSignInDescription'
+                                    defaultMessage='When true, Mattermost allows users to sign in using their username and password.  This setting is typically only used when email verification is disabled.'
+                                />
+                            </p>
+                        </div>
+                    </div>
+
                     <div className='form-group'>
                         <label
                             className='control-label col-sm-4'
-- 
cgit v1.2.3-1-g7c22

