From d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Mon, 8 Feb 2016 07:26:10 -0500
Subject: Convering client to react-router.

---
 .../user_settings/user_settings_security.jsx       | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

(limited to 'web/react/components/user_settings/user_settings_security.jsx')

diff --git a/web/react/components/user_settings/user_settings_security.jsx b/web/react/components/user_settings/user_settings_security.jsx
index cba7ffdea..0b6b6c398 100644
--- a/web/react/components/user_settings/user_settings_security.jsx
+++ b/web/react/components/user_settings/user_settings_security.jsx
@@ -14,7 +14,7 @@ import * as AsyncClient from '../../utils/async_client.jsx';
 import * as Utils from '../../utils/utils.jsx';
 import Constants from '../../utils/constants.jsx';
 
-import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl';
+import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedTime, FormattedDate} from 'mm-intl';
 
 const holders = defineMessages({
     currentPasswordError: {
@@ -218,11 +218,24 @@ class SecurityTab extends React.Component {
         var describe;
         var d = new Date(this.props.user.last_password_update);
 
-        const locale = global.window.mm_locale;
         const hours12 = !Utils.isMilitaryTime();
         describe = formatMessage(holders.lastUpdated, {
-            date: d.toLocaleDateString(locale, {month: 'short', day: '2-digit', year: 'numeric'}),
-            time: d.toLocaleTimeString(locale, {hour12: hours12, hour: '2-digit', minute: '2-digit'})
+            date: (
+                <FormattedDate
+                    value={d}
+                    day='2-digit'
+                    month='short'
+                    year='numeric'
+                />
+            ),
+            time: (
+                <FormattedTime
+                    value={d}
+                    hour12={hours12}
+                    hour='2-digit'
+                    minute='2-digit'
+                />
+            )
         });
 
         updateSectionStatus = function updateSection() {
@@ -251,7 +264,7 @@ class SecurityTab extends React.Component {
                     <div>
                         <a
                             className='btn btn-primary'
-                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email)}
+                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service}
                         >
                             <FormattedMessage
                                 id='user.settings.security.switchEmail'
@@ -269,7 +282,7 @@ class SecurityTab extends React.Component {
                     <div>
                         <a
                             className='btn btn-primary'
-                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&new_type=' + Constants.GITLAB_SERVICE}
+                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.GITLAB_SERVICE}
                         >
                             <FormattedMessage
                                 id='user.settings.security.switchGitlab'
@@ -287,7 +300,7 @@ class SecurityTab extends React.Component {
                     <div>
                         <a
                             className='btn btn-primary'
-                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&new_type=' + Constants.GOOGLE_SERVICE}
+                            href={'/' + teamName + '/claim?email=' + encodeURIComponent(user.email) + '&old_type=' + user.auth_service + '&new_type=' + Constants.GOOGLE_SERVICE}
                         >
                             <FormattedMessage
                                 id='user.settings.security.switchGoogle'
@@ -456,4 +469,4 @@ SecurityTab.propTypes = {
     setEnforceFocus: React.PropTypes.func.isRequired
 };
 
-export default injectIntl(SecurityTab);
\ No newline at end of file
+export default injectIntl(SecurityTab);
-- 
cgit v1.2.3-1-g7c22

