Skip to content

Commit

Permalink
Merge pull request #1444 from Expensify/stites-removeGithubRequirement
Browse files Browse the repository at this point in the history
Open E.cash to non-developers
  • Loading branch information
tgolen authored Mar 15, 2021
2 parents 9958a3b + ae9f4ca commit dbb7932
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 225 deletions.
13 changes: 0 additions & 13 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function isAuthTokenRequired(command) {
'Graphite_Timer',
'Authenticate',
'GetAccountStatus',
'SetGithubUsername',
'SetPassword',
'User_SignUp',
'ResendValidateCode',
Expand Down Expand Up @@ -540,17 +539,6 @@ function ResendValidateCode(parameters) {
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.githubUsername
* @returns {Promise}
*/
function SetGithubUsername(parameters) {
const commandName = 'SetGithubUsername';
requireParameters(['email', 'githubUsername'], parameters, commandName);
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.password
Expand Down Expand Up @@ -654,7 +642,6 @@ export {
Report_TogglePinned,
Report_UpdateLastRead,
ResendValidateCode,
SetGithubUsername,
SetNameValuePair,
SetPassword,
UpdateAccount,
Expand Down
26 changes: 0 additions & 26 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function fetchAccountDetails(login) {
});
Onyx.merge(ONYXKEYS.ACCOUNT, {
accountExists: response.accountExists,
canAccessExpensifyCash: response.canAccessExpensifyCash,
requiresTwoFactorAuth: response.requiresTwoFactorAuth,
});

Expand Down Expand Up @@ -183,30 +182,6 @@ function signIn(password, twoFactorAuthCode) {
});
}

/**
* Puts the github username into Onyx so that it can be used when creating accounts or logins
*
* @param {String} username
*/
function setGitHubUsername(username) {
Onyx.merge(ONYXKEYS.ACCOUNT, {error: '', loading: true});

API.SetGithubUsername({email: credentials.login, githubUsername: username})
.then((response) => {
if (response.jsonCode === 200) {
Onyx.merge(ONYXKEYS.CREDENTIALS, {githubUsername: username});
Onyx.merge(ONYXKEYS.ACCOUNT, {canAccessExpensifyCash: true});
return;
}

// This request can fail if an invalid GitHub username was entered
Onyx.merge(ONYXKEYS.ACCOUNT, {error: 'Please enter a valid GitHub username'});
})
.finally(() => {
Onyx.merge(ONYXKEYS.ACCOUNT, {loading: false});
});
}

/**
* Resend the validation link to the user that is validating their account
* this happens in the createAccount() flow
Expand Down Expand Up @@ -259,7 +234,6 @@ function setPassword(password, validateCode) {

export {
fetchAccountDetails,
setGitHubUsername,
setPassword,
signIn,
signOut,
Expand Down
109 changes: 0 additions & 109 deletions src/pages/signin/GithubUsernameForm.js

This file was deleted.

29 changes: 5 additions & 24 deletions src/pages/signin/LoginForm/LoginFormNarrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import _ from 'underscore';
import styles from '../../../styles/styles';
import themeColors from '../../../styles/themes/default';
import ButtonWithLoader from '../../../components/ButtonWithLoader';
import openURLInNewTab from '../../../libs/openURLInNewTab';
import {fetchAccountDetails} from '../../../libs/actions/Session';
import welcomeScreenshot from '../../../../assets/images/welcome-screenshot.png';
import CONST from '../../../CONST';
import ONYXKEYS from '../../../ONYXKEYS';

const propTypes = {
Expand Down Expand Up @@ -64,7 +62,7 @@ class LoginFormNarrow extends React.Component {
return (
<View style={[styles.loginFormContainer]}>
<View style={[styles.mb4]}>
<Text style={[styles.formLabel]}>Sign up for the waitlist</Text>
<Text style={[styles.formLabel]}>Enter your phone or email:</Text>
<TextInput
style={[styles.textInput]}
value={this.state.login}
Expand All @@ -73,7 +71,7 @@ class LoginFormNarrow extends React.Component {
onChangeText={text => this.setState({login: text})}
onSubmitEditing={this.validateAndSubmitForm}
autoCapitalize="none"
placeholder="Email or phone"
placeholder="Phone or Email"
placeholderTextColor={themeColors.textSupporting}
/>
</View>
Expand Down Expand Up @@ -105,31 +103,14 @@ class LoginFormNarrow extends React.Component {
/>
</View>

<View style={[styles.mb6]}>
<Text style={[styles.textLabel]}>
With Expensify.cash, chat and payments are the same thing. Launching Summer 2021,
{' '}
join the waitlist to be first in line!
</Text>
</View>

<View>
<Text style={[styles.textLabel, styles.textStrong, styles.mb1]}>
Attention Open Source Developers:
With Expensify.cash, chat and payments are the same thing.
</Text>
<Text style={[styles.textLabel]}>
Enter your GitHub handle on the next page to skip the wait and join our dev-only beta;
{' '}
help build tomorrow and
{' '}
<Text
style={[styles.link, styles.mx1]}
onPress={() => openURLInNewTab(CONST.UPWORK_URL)}
>
earn cash
</Text>
Money talks. And now that chat and payments are in one place, it&apos;s also easy.
{' '}
today!
Your payments get to you as fast as you can get your point across.
</Text>
</View>
</View>
Expand Down
29 changes: 5 additions & 24 deletions src/pages/signin/LoginForm/LoginFormWide.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import _ from 'underscore';
import {fetchAccountDetails} from '../../../libs/actions/Session';
import styles from '../../../styles/styles';
import ButtonWithLoader from '../../../components/ButtonWithLoader';
import openURLInNewTab from '../../../libs/openURLInNewTab';
import CONST from '../../../CONST';
import ONYXKEYS from '../../../ONYXKEYS';

const propTypes = {
Expand Down Expand Up @@ -61,7 +59,7 @@ class LoginFormWide extends React.Component {
<>
<View style={[styles.loginFormContainer]}>
<View style={[styles.mb4]}>
<Text style={[styles.formLabel]}>Sign up for the waitlist</Text>
<Text style={[styles.formLabel]}>Enter your phone or email:</Text>
<TextInput
style={[styles.textInput]}
value={this.state.login}
Expand All @@ -70,7 +68,7 @@ class LoginFormWide extends React.Component {
onChangeText={text => this.setState({login: text})}
onSubmitEditing={this.validateAndSubmitForm}
autoCapitalize="none"
placeholder="Email or phone"
placeholder="Phone or Email"
autoFocus
/>
</View>
Expand All @@ -96,31 +94,14 @@ class LoginFormWide extends React.Component {
</View>

<View style={[styles.mt6]}>
<View style={[styles.mb6]}>
<Text style={[styles.textP]}>
With Expensify.cash, chat and payments are the same thing. Launching Summer 2021,
{' '}
join the waitlist to be first in line!
</Text>
</View>

<View style={[styles.mb6]}>
<Text style={[styles.textP, styles.textStrong, styles.mb1]}>
Attention Open Source Developers:
With Expensify.cash, chat and payments are the same thing.
</Text>
<Text style={[styles.textP]}>
Enter your Github handle on the next page to skip the wait and join our dev-only beta;
{' '}
help build tomorrow and
{' '}
<Text
style={[styles.link, styles.mx1]}
onPress={() => openURLInNewTab(CONST.UPWORK_URL)}
>
earn cash
</Text>
Money talks. And now that chat and payments are in one place, it&apos;s also easy.
{' '}
today!
Your payments get to you as fast as you can get your point across.
</Text>
</View>
</View>
Expand Down
3 changes: 0 additions & 3 deletions src/pages/signin/PasswordForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const propTypes = {
// Whether or not the account already exists
accountExists: PropTypes.bool,

// Whether or not there have been chat reports shared with this user
canAccessExpensifyCash: PropTypes.bool,

// Whether or not two factor authentication is required
requiresTwoFactorAuth: PropTypes.bool,

Expand Down
25 changes: 0 additions & 25 deletions src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import styles from '../../styles/styles';
import updateUnread from '../../libs/UnreadIndicatorUpdater/updateUnread/index';
import SignInPageLayout from './SignInPageLayout';
import LoginForm from './LoginForm';
import GithubUsernameForm from './GithubUsernameForm';
import PasswordForm from './PasswordForm';
import ResendValidationForm from './ResendValidationForm';

Expand All @@ -22,17 +21,13 @@ const propTypes = {
// Whether or not the account already exists
accountExists: PropTypes.bool,

// Whether or not there have been chat reports shared with this user
canAccessExpensifyCash: PropTypes.bool,

// Error to display when there is an account error returned
error: PropTypes.string,
}),

// The credentials of the person signing in
credentials: PropTypes.shape({
login: PropTypes.string,
githubUsername: PropTypes.string,
password: PropTypes.string,
twoFactorAuthCode: PropTypes.string,
}),
Expand Down Expand Up @@ -61,26 +56,12 @@ class SignInPage extends Component {
// - A login has not been entered yet
const showLoginForm = !this.props.credentials.login;

// Show the GitHub username form if
// - A login has been entered
// - AND they do not have access to this app yet
// - AND the user hasn't entered a GitHub username yet
// - AND a password hasn't been entered yet
const showGithubUsernameForm = this.props.credentials.login
&& !this.props.account.canAccessExpensifyCash
&& !this.props.credentials.githubUsername
&& !this.props.credentials.password;

// Show the password form if
// - A login has been entered
// - AND a GitHub username has been entered OR they already have access to expensify cash
// - AND an account exists already for this login
// - AND a password hasn't been entered yet
const showPasswordForm = this.props.credentials.login
&& (
this.props.credentials.githubUsername
|| this.props.account.canAccessExpensifyCash
)
&& this.props.account.accountExists
&& !this.props.credentials.password;

Expand All @@ -89,10 +70,6 @@ class SignInPage extends Component {
// - AND a GitHub username has been entered OR they already have access to this app
// - AND an account did not exist for that login
const showResendValidationLinkForm = this.props.credentials.login
&& (
this.props.credentials.githubUsername
|| this.props.account.canAccessExpensifyCash
)
&& !this.props.account.accountExists;

return (
Expand All @@ -101,8 +78,6 @@ class SignInPage extends Component {
<SignInPageLayout>
{showLoginForm && <LoginForm />}

{showGithubUsernameForm && <GithubUsernameForm />}

{showPasswordForm && <PasswordForm />}

{showResendValidationLinkForm && <ResendValidationForm />}
Expand Down
Loading

0 comments on commit dbb7932

Please sign in to comment.