Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open E.cash to non-developers #1444

Merged
merged 6 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
alex-mechler marked this conversation as resolved.
Show resolved Hide resolved
const commandName = 'SetGithubUsername';
requireParameters(['email', 'githubUsername'], parameters, commandName);
return Network.post(commandName, parameters);
}

/**
* @param {Object} parameters
* @param {String} parameters.password
Expand Down Expand Up @@ -636,7 +624,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 @@ -88,7 +88,6 @@ function fetchAccountDetails(login) {
});
Onyx.merge(ONYXKEYS.ACCOUNT, {
accountExists: response.accountExists,
canAccessExpensifyCash: response.canAccessExpensifyCash,
requiresTwoFactorAuth: response.requiresTwoFactorAuth,
});

Expand Down Expand Up @@ -185,30 +184,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 @@ -261,7 +236,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.

30 changes: 5 additions & 25 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,13 @@ 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>
{' '}
today!
{'Money talks. And now that chat and payments are in one place, it\'s also easy. '}
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
Your payments get to you as fast as you can get your point across.
</Text>
</View>
</View>
Expand Down
30 changes: 5 additions & 25 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,13 @@ 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>
{' '}
today!
{'Money talks. And now that chat and payments are in one place, it\'s also easy. '}
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -13,7 +13,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 @@ -25,17 +24,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 @@ -70,26 +65,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 @@ -98,10 +79,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 @@ -110,8 +87,6 @@ class SignInPage extends Component {
<SignInPageLayout>
{showLoginForm && <LoginForm />}

{showGithubUsernameForm && <GithubUsernameForm />}

{showPasswordForm && <PasswordForm />}

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