summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
Diffstat (limited to 'web/react')
-rw-r--r--web/react/components/tutorial/tutorial_intro_screens.jsx54
-rw-r--r--web/react/components/user_settings/user_settings_general.jsx90
-rw-r--r--web/react/stores/browser_store.jsx37
-rw-r--r--web/react/stores/user_store.jsx9
-rw-r--r--web/react/utils/client.jsx1
5 files changed, 132 insertions, 59 deletions
diff --git a/web/react/components/tutorial/tutorial_intro_screens.jsx b/web/react/components/tutorial/tutorial_intro_screens.jsx
index a99e9fe28..66ca556c6 100644
--- a/web/react/components/tutorial/tutorial_intro_screens.jsx
+++ b/web/react/components/tutorial/tutorial_intro_screens.jsx
@@ -11,12 +11,15 @@ const AsyncClient = require('../../utils/async_client.jsx');
const Constants = require('../../utils/constants.jsx');
const Preferences = Constants.Preferences;
+const NUM_SCREENS = 3;
+
export default class TutorialIntroScreens extends React.Component {
constructor(props) {
super(props);
this.handleNext = this.handleNext.bind(this);
this.createScreen = this.createScreen.bind(this);
+ this.createCircles = this.createCircles.bind(this);
this.state = {currentScreen: 0};
}
@@ -49,31 +52,27 @@ export default class TutorialIntroScreens extends React.Component {
}
}
createScreenOne() {
+ const circles = this.createCircles();
+
return (
<div>
<h3>{'Welcome to:'}</h3>
<h1>{'Mattermost'}</h1>
<p>{'Your team communication all in one place, instantly searchable and available anywhere.'}</p>
<p>{'Keep your team connected to help them achieve what matters most.'}</p>
- <div className='tutorial__circles'>
- <div className='circle active'/>
- <div className='circle'/>
- <div className='circle'/>
- </div>
+ {circles}
</div>
);
}
createScreenTwo() {
+ const circles = this.createCircles();
+
return (
<div>
<h3>{'How Mattermost works:'}</h3>
<p>{'Communication happens in public discussion channels, private groups and direct messages.'}</p>
<p>{'Everything is archived and searchable from any web-enabled desktop, laptop or phone.'}</p>
- <div className='tutorial__circles'>
- <div className='circle'/>
- <div className='circle active'/>
- <div className='circle'/>
- </div>
+ {circles}
</div>
);
}
@@ -106,6 +105,8 @@ export default class TutorialIntroScreens extends React.Component {
);
}
+ const circles = this.createCircles();
+
return (
<div>
<h3>{'You’re all set'}</h3>
@@ -124,11 +125,34 @@ export default class TutorialIntroScreens extends React.Component {
{'.'}
</p>
{'Click “Next” to enter Town Square. This is the first channel teammates see when they sign up. Use it for posting updates everyone needs to know.'}
- <div className='tutorial__circles'>
- <div className='circle'/>
- <div className='circle'/>
- <div className='circle active'/>
- </div>
+ {circles}
+ </div>
+ );
+ }
+ createCircles() {
+ const circles = [];
+ for (let i = 0; i < NUM_SCREENS; i++) {
+ let className = 'circle';
+ if (i === this.state.currentScreen) {
+ className += ' active';
+ }
+
+ circles.push(
+ <a
+ href='#'
+ key={'circle' + i}
+ className={className}
+ onClick={(e) => { //eslint-disable-line no-loop-func
+ e.preventDefault();
+ this.setState({currentScreen: i});
+ }}
+ />
+ );
+ }
+
+ return (
+ <div className='tutorial__circles'>
+ {circles}
</div>
);
}
diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx
index 9f0c16194..1bfae6930 100644
--- a/web/react/components/user_settings/user_settings_general.jsx
+++ b/web/react/components/user_settings/user_settings_general.jsx
@@ -451,44 +451,60 @@ export default class UserSettingsGeneralTab extends React.Component {
}
}
- inputs.push(
- <div key='emailSetting'>
- <div className='form-group'>
- <label className='col-sm-5 control-label'>{'Primary Email'}</label>
- <div className='col-sm-7'>
- <input
- className='form-control'
- type='text'
- onChange={this.updateEmail}
- value={this.state.email}
- />
+ let submit = null;
+
+ if (this.props.user.auth_service === '') {
+ inputs.push(
+ <div key='emailSetting'>
+ <div className='form-group'>
+ <label className='col-sm-5 control-label'>{'Primary Email'}</label>
+ <div className='col-sm-7'>
+ <input
+ className='form-control'
+ type='text'
+ onChange={this.updateEmail}
+ value={this.state.email}
+ />
+ </div>
</div>
</div>
- </div>
- );
-
- inputs.push(
- <div key='confirmEmailSetting'>
- <div className='form-group'>
- <label className='col-sm-5 control-label'>{'Confirm Email'}</label>
- <div className='col-sm-7'>
- <input
- className='form-control'
- type='text'
- onChange={this.updateConfirmEmail}
- value={this.state.confirmEmail}
- />
+ );
+
+ inputs.push(
+ <div key='confirmEmailSetting'>
+ <div className='form-group'>
+ <label className='col-sm-5 control-label'>{'Confirm Email'}</label>
+ <div className='col-sm-7'>
+ <input
+ className='form-control'
+ type='text'
+ onChange={this.updateConfirmEmail}
+ value={this.state.confirmEmail}
+ />
+ </div>
</div>
+ {helpText}
</div>
- {helpText}
- </div>
- );
+ );
+
+ submit = this.submitEmail;
+ } else {
+ inputs.push(
+ <div
+ key='oauthEmailInfo'
+ className='form-group'
+ >
+ <div className='setting-list__hint'>{'Log in occurs through GitLab. Email cannot be updated.'}</div>
+ {helpText}
+ </div>
+ );
+ }
emailSection = (
<SettingItemMax
title='Email'
inputs={inputs}
- submit={this.submitEmail}
+ submit={submit}
server_error={serverError}
client_error={emailError}
updateSection={function clearSection(e) {
@@ -499,15 +515,19 @@ export default class UserSettingsGeneralTab extends React.Component {
);
} else {
let describe = '';
- if (this.state.emailChangeInProgress) {
- const newEmail = UserStore.getCurrentUser().email;
- if (newEmail) {
- describe = 'New Address: ' + newEmail + '\nCheck your email to verify the above address.';
+ if (this.props.user.auth_service === '') {
+ if (this.state.emailChangeInProgress) {
+ const newEmail = UserStore.getCurrentUser().email;
+ if (newEmail) {
+ describe = 'New Address: ' + newEmail + '\nCheck your email to verify the above address.';
+ } else {
+ describe = 'Check your email to verify your new address';
+ }
} else {
- describe = 'Check your email to verify your new address';
+ describe = UserStore.getCurrentUser().email;
}
} else {
- describe = UserStore.getCurrentUser().email;
+ describe = 'Log in done through GitLab';
}
emailSection = (
diff --git a/web/react/stores/browser_store.jsx b/web/react/stores/browser_store.jsx
index 75fb8aa3c..8e86ce32f 100644
--- a/web/react/stores/browser_store.jsx
+++ b/web/react/stores/browser_store.jsx
@@ -24,11 +24,17 @@ class BrowserStoreClass {
this.setLastServerVersion = this.setLastServerVersion.bind(this);
this.clear = this.clear.bind(this);
this.clearAll = this.clearAll.bind(this);
+ this.checkedLocalStorageSupported = '';
+ this.signalLogout = this.signalLogout.bind(this);
var currentVersion = sessionStorage.getItem('storage_version');
if (currentVersion !== global.window.mm_config.Version) {
sessionStorage.clear();
- sessionStorage.setItem('storage_version', global.window.mm_config.Version);
+ try {
+ sessionStorage.setItem('storage_version', global.window.mm_config.Version);
+ } catch (e) {
+ // Do nothing
+ }
}
}
@@ -105,6 +111,13 @@ class BrowserStoreClass {
sessionStorage.setItem('last_server_version', version);
}
+ signalLogout() {
+ if (this.isLocalStorageSupported()) {
+ localStorage.setItem('__logout__', 'yes');
+ localStorage.removeItem('__logout__');
+ }
+ }
+
/**
* Preforms the given action on each item that has the given prefix
* Signature for action is action(key, value)
@@ -147,20 +160,26 @@ class BrowserStoreClass {
}
isLocalStorageSupported() {
+ if (this.checkedLocalStorageSupported !== '') {
+ return this.checkedLocalStorageSupported;
+ }
+
try {
- sessionStorage.setItem('testSession', '1');
- sessionStorage.removeItem('testSession');
+ sessionStorage.setItem('__testSession__', '1');
+ sessionStorage.removeItem('__testSession__');
- localStorage.setItem('testLocal', '1');
- if (localStorage.getItem('testLocal') !== '1') {
- return false;
+ localStorage.setItem('__testLocal__', '1');
+ if (localStorage.getItem('__testLocal__') !== '1') {
+ this.checkedLocalStorageSupported = false;
}
- localStorage.removeItem('testLocal', '1');
+ localStorage.removeItem('__testLocal__', '1');
- return true;
+ this.checkedLocalStorageSupported = true;
} catch (e) {
- return false;
+ this.checkedLocalStorageSupported = false;
}
+
+ return this.checkedLocalStorageSupported;
}
}
diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx
index 4fa7224b7..6b7d671fc 100644
--- a/web/react/stores/user_store.jsx
+++ b/web/react/stores/user_store.jsx
@@ -58,6 +58,8 @@ class UserStoreClass extends EventEmitter {
this.setStatus = this.setStatus.bind(this);
this.getStatuses = this.getStatuses.bind(this);
this.getStatus = this.getStatus.bind(this);
+
+ this.profileCache = null;
}
emitChange(userId) {
@@ -184,6 +186,10 @@ class UserStoreClass extends EventEmitter {
}
getProfiles() {
+ if (this.profileCache !== null) {
+ return this.profileCache;
+ }
+
return BrowserStore.getItem('profiles', {});
}
@@ -218,6 +224,7 @@ class UserStoreClass extends EventEmitter {
saveProfile(profile) {
var ps = this.getProfiles();
ps[profile.id] = profile;
+ this.profileCache = ps;
BrowserStore.setItem('profiles', ps);
}
@@ -226,6 +233,8 @@ class UserStoreClass extends EventEmitter {
if (currentId in profiles) {
delete profiles[currentId];
}
+
+ this.profileCache = profiles;
BrowserStore.setItem('profiles', profiles);
}
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 003e24d33..d27fe16cf 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -231,6 +231,7 @@ export function resetPassword(data, success, error) {
export function logout() {
track('api', 'api_users_logout');
var currentTeamUrl = TeamStore.getCurrentTeamUrl();
+ BrowserStore.signalLogout();
BrowserStore.clear();
ErrorStore.storeLastError(null);
window.location.href = currentTeamUrl + '/logout';