From 284b3bb64c4edd3f2d336d35a6df9495d99cdf55 Mon Sep 17 00:00:00 2001
From: Chengwei Yang <yangchengwei@qiyi.com>
Date: Wed, 23 Sep 2015 16:57:48 +0800
Subject: PLT-168: check email used to reset password strictly

Signed-off-by: Chengwei Yang <yangchengwei@qiyi.com>
---
 web/react/components/password_reset_send_link.jsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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

diff --git a/web/react/components/password_reset_send_link.jsx b/web/react/components/password_reset_send_link.jsx
index 1e6cc3607..37d4a58cb 100644
--- a/web/react/components/password_reset_send_link.jsx
+++ b/web/react/components/password_reset_send_link.jsx
@@ -1,6 +1,7 @@
 // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
 // See License.txt for license information.
 
+const Utils = require('../utils/utils.jsx');
 var client = require('../utils/client.jsx');
 
 export default class PasswordResetSendLink extends React.Component {
@@ -15,8 +16,8 @@ export default class PasswordResetSendLink extends React.Component {
         e.preventDefault();
         var state = {};
 
-        var email = React.findDOMNode(this.refs.email).value.trim();
-        if (!email) {
+        var email = React.findDOMNode(this.refs.email).value.trim().toLowerCase();
+        if (!email || !Utils.isEmail(email)) {
             state.error = 'Please enter a valid email address.';
             this.setState(state);
             return;
@@ -67,7 +68,7 @@ export default class PasswordResetSendLink extends React.Component {
                         <p>{'To reset your password, enter the email address you used to sign up for ' + this.props.teamDisplayName + '.'}</p>
                         <div className={formClass}>
                             <input
-                                type='text'
+                                type='email'
                                 className='form-control'
                                 name='email'
                                 ref='email'
-- 
cgit v1.2.3-1-g7c22

