Skip to content

Commit

Permalink
feat: Feature toggle for account registration (WEBAPP-5671, WEBAPP-5673
Browse files Browse the repository at this point in the history
…) (#5395)
  • Loading branch information
Yserz committed Dec 12, 2018
1 parent b720cfe commit 57d0251
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env
Expand Up @@ -13,6 +13,7 @@ CSP_EXTRA_IMG_SRC="https://*.zinfra.io, https://*.wire.com"
CSP_EXTRA_SCRIPT_SRC="http://localhost:32123, https://*.zinfra.io, https://*.wire.com, https://api.raygun.io"
ENFORCE_HTTPS="false"
FEATURE_CHECK_CONSENT="true"
FEATURE_ENABLE_ACCOUNT_REGISTRATION="true"
FEATURE_ENABLE_DEBUG="true"
FEATURE_ENABLE_SSO="true"
FEATURE_SHOW_LOADING_INFORMATION="true"
Expand Down
3 changes: 3 additions & 0 deletions app/script/auth/config.ts
Expand Up @@ -37,6 +37,7 @@ declare global {
VERSION: string;
FEATURE: {
CHECK_CONSENT: boolean;
ENABLE_ACCOUNT_REGISTRATION: boolean;
ENABLE_DEBUG: boolean;
ENABLE_SSO: boolean;
SHOW_LOADING_INFORMATION: boolean;
Expand All @@ -60,7 +61,9 @@ export const URL = window.wire.env.URL || {
export const VERSION = window.wire.env.VERSION || '0.0.0';
export const FEATURE = window.wire.env.FEATURE || {
CHECK_CONSENT: true,
ENABLE_ACCOUNT_REGISTRATION: true,
ENABLE_DEBUG: false,
ENABLE_SSO: false,
SHOW_LOADING_INFORMATION: false,
};
export const APP_INSTANCE_ID = UUID();
5 changes: 4 additions & 1 deletion app/script/auth/page/Index.tsx
Expand Up @@ -33,12 +33,14 @@ import {
import * as React from 'react';
import {InjectedIntlProps, injectIntl} from 'react-intl';
import {connect} from 'react-redux';
import {RouteComponentProps} from 'react-router';
import {Redirect, RouteComponentProps} from 'react-router';
import {indexStrings} from '../../strings';
import {FEATURE} from '../config';
import {RootState, ThunkDispatch} from '../module/reducer';
import * as LanguageSelector from '../module/selector/LanguageSelector';
import {ROUTE} from '../route';
import {isDesktopApp, isMacOS} from '../Runtime';
import {pathWithParams} from '../util/urlUtil';
import Page from './Page';

interface Props extends React.HTMLAttributes<Index>, RouteComponentProps {}
Expand Down Expand Up @@ -71,6 +73,7 @@ class Index extends React.Component<Props & ConnectedProps & DispatchProps & Inj
const isMacOsWrapper = isDesktopApp() && isMacOS();
return (
<Page>
{!FEATURE.ENABLE_ACCOUNT_REGISTRATION && <Redirect to={pathWithParams(ROUTE.LOGIN)} />}
<ContainerXS centerText verticalCenter>
<Logo scale={1.68} data-uie-name="ui-wire-logo" />
<Columns style={{margin: '70px auto'}}>
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/page/Login.tsx
Expand Up @@ -311,7 +311,7 @@ class Login extends React.Component<CombinedProps, State> {
<Columns>
<IsMobile not>
<Column style={{display: 'flex'}}>
<div style={{margin: 'auto'}}>{backArrow}</div>
{config.FEATURE.ENABLE_ACCOUNT_REGISTRATION && <div style={{margin: 'auto'}}>{backArrow}</div>}
</Column>
</IsMobile>
<Column style={{flexBasis: 384, flexGrow: 0, padding: 0}}>
Expand Down
14 changes: 9 additions & 5 deletions app/script/auth/page/Root.tsx
Expand Up @@ -23,7 +23,7 @@ import {IntlProvider, addLocaleData} from 'react-intl';
import * as de from 'react-intl/locale-data/de';
import {connect} from 'react-redux';
import {HashRouter as Router, Redirect, Route, Switch} from 'react-router-dom';
import {APP_INSTANCE_ID} from '../config';
import {APP_INSTANCE_ID, FEATURE} from '../config';
import ROOT_ACTIONS from '../module/action/';
import {RootState, ThunkDispatch} from '../module/reducer';
import * as CookieSelector from '../module/selector/CookieSelector';
Expand Down Expand Up @@ -86,10 +86,14 @@ class Root extends React.Component<Props & ConnectedProps & DispatchProps, State
<Route path={ROUTE.LOGIN} component={Login} />
<Route path={ROUTE.CONVERSATION_JOIN} component={ConversationJoin} />
<Route path={ROUTE.CONVERSATION_JOIN_INVALID} component={ConversationJoinInvalid} />
<Route path={ROUTE.CREATE_TEAM} component={TeamName} />
<Route path={ROUTE.CREATE_TEAM_ACCOUNT} component={CreateAccount} />
<Route path={ROUTE.CREATE_ACCOUNT} component={CreatePersonalAccount} />
<Route path={ROUTE.VERIFY} component={Verify} />
{FEATURE.ENABLE_ACCOUNT_REGISTRATION && (
<>
<Route path={ROUTE.CREATE_TEAM} component={TeamName} />
<Route path={ROUTE.CREATE_ACCOUNT} component={CreatePersonalAccount} />
<Route path={ROUTE.CREATE_TEAM_ACCOUNT} component={CreateAccount} />
<Route path={ROUTE.VERIFY} component={Verify} />
</>
)}
<Route path={ROUTE.INITIAL_INVITE} component={InitialInvite} />
<Route path={ROUTE.CHOOSE_HANDLE} component={ChooseHandle} />
<Route path={ROUTE.HISTORY_INFO} component={HistoryInfo} />
Expand Down
1 change: 1 addition & 0 deletions server/ServerConfig.ts
Expand Up @@ -16,6 +16,7 @@ export interface ServerConfig {
};
FEATURE: {
CHECK_CONSENT: boolean;
ENABLE_ACCOUNT_REGISTRATION: boolean;
ENABLE_DEBUG: boolean;
ENABLE_SSO: boolean;
SHOW_LOADING_INFORMATION: boolean;
Expand Down
1 change: 1 addition & 0 deletions server/config.ts
Expand Up @@ -129,6 +129,7 @@ const config: ServerConfig = {
ENVIRONMENT: nodeEnvironment,
FEATURE: {
CHECK_CONSENT: process.env.FEATURE_CHECK_CONSENT == 'false' ? false : true,
ENABLE_ACCOUNT_REGISTRATION: process.env.FEATURE_ENABLE_ACCOUNT_REGISTRATION == 'false' ? false : true,
ENABLE_DEBUG: process.env.FEATURE_ENABLE_DEBUG == 'true' ? true : false,
ENABLE_SSO: process.env.FEATURE_ENABLE_SSO == 'true' ? true : false,
SHOW_LOADING_INFORMATION: process.env.FEATURE_SHOW_LOADING_INFORMATION == 'true' ? true : false,
Expand Down

0 comments on commit 57d0251

Please sign in to comment.