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

GH-2206: Onboarding - Step 1 - Create Account #639

Merged
merged 36 commits into from Dec 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
834bb52
Make form
benstrumeyer Dec 1, 2020
3300d83
Add skip and learn more links
benstrumeyer Dec 1, 2020
5911f47
Set arrow up/down depending on expanded state
benstrumeyer Dec 1, 2020
a56094f
Make FAQ
benstrumeyer Dec 1, 2020
f623f22
Make list responsive
benstrumeyer Dec 1, 2020
9d641f9
Adjust padding of FAQContainer to scroll onto nice spot
benstrumeyer Dec 1, 2020
f9ad55e
Make sure promoString checkbox text does not wrap
benstrumeyer Dec 1, 2020
13d10ee
Add privacy policy link
benstrumeyer Dec 1, 2020
11f908c
Make privacy policy link more responsive
benstrumeyer Dec 1, 2020
6cfcdce
Make BrowserLogInForm and style responsively
benstrumeyer Dec 2, 2020
9f024a5
Refactor Create Account form into a component
benstrumeyer Dec 2, 2020
0371513
Create BrowserCreateAccountFormContainer and add handlers
benstrumeyer Dec 2, 2020
7a04bd3
Add error handling to legal consent label
benstrumeyer Dec 2, 2020
31b8e8e
Remove privacy policy link if learn more is not expanded
benstrumeyer Dec 2, 2020
2071175
Add handlers for log in view and replace strings
benstrumeyer Dec 2, 2020
74b0a41
Add handlers for forgot password and throttle it
benstrumeyer Dec 2, 2020
7d9bd47
Lower throttle time in case user enters a wrong email
benstrumeyer Dec 2, 2020
ba6f3c9
Make updates checkbox work
benstrumeyer Dec 2, 2020
c098331
Add signed in view
benstrumeyer Dec 2, 2020
1087c46
Change spacing of title and subtitle for small screens
benstrumeyer Dec 2, 2020
b8c2629
Update create account design for small screens
benstrumeyer Dec 2, 2020
e187609
Center skip link on small screens
benstrumeyer Dec 2, 2020
a6e9257
Decrease spacing for small sreens on already have account/create acco…
benstrumeyer Dec 2, 2020
f715cf7
Decrease width of faqDescription items and privacy policy link
benstrumeyer Dec 2, 2020
8b6838d
Open privacy policy link in new tab
benstrumeyer Dec 2, 2020
817ce0b
Add confirm password functionality
benstrumeyer Dec 4, 2020
dfc6ec9
Update passwords not match string
benstrumeyer Dec 4, 2020
7ff259f
Add global email preferences to user object on account creation success
benstrumeyer Dec 4, 2020
143cce8
Hold input fields in place when error messages appear
benstrumeyer Dec 4, 2020
136ef0d
Merge branch 'ghostery-browser-intro-hub' into GH-2206
benstrumeyer Dec 4, 2020
eda38ca
Rename components
benstrumeyer Dec 4, 2020
91badf5
Add propTypes
benstrumeyer Dec 5, 2020
1b24823
Update comments
benstrumeyer Dec 5, 2020
6ce6eca
Remove newline
benstrumeyer Dec 5, 2020
44518ad
Update confirm password string
benstrumeyer Dec 5, 2020
6ff20ca
Add comments and minor refactors
benstrumeyer Dec 5, 2020
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Add handlers for forgot password and throttle it

  • Loading branch information
benstrumeyer committed Dec 2, 2020
commit 74b0a41df519832ab4fc5370b3dca2f212e21716
@@ -29,6 +29,7 @@ const BrowserLogInForm = (props) => {
passwordError,
handleSubmit,
handleInputChange,
handleForgotPassword,
} = props;

const emailInputClassNames = ClassNames('BrowserLogInForm__inputBox', {
@@ -86,10 +87,10 @@ const BrowserLogInForm = (props) => {
</div>
<div className="BrowserLogInForm__item row align-center-middle">
<div className="columns small-10">
<span className="BrowserLogInForm__link text-center">
<NavLink to="/forgot-password">
<span className="BrowserLogInForm__link">
<div className="BrowserLogInForm__forgotPassword" onClick={handleForgotPassword}>
{t('forgot_password')}
</NavLink>
</div>
</span>
</div>
</div>
@@ -64,6 +64,11 @@
font-size: 14px;
line-height: 30px;
}
.BrowserLogInForm__forgotPassword {
color: $ghosty-blue;
text-decoration: underline;
cursor: pointer;
}
.BrowserLogInForm__button {
min-width: 180px;
}
@@ -13,9 +13,11 @@

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { throttle } from 'underscore';
import { validateEmail } from '../../../panel/utils/utils';
import BrowserLogInForm from './BrowserLogInForm';
import SignedInView from '../SignedInView';

/**
* @class Implement the Browser Log In Form for the Ghostery Hub
* @extends Component
@@ -89,7 +91,7 @@ class BrowserLogInFormContainer extends Component {
return;
}

const { actions, history } = this.props;
const { actions } = this.props;
actions.setToast({
toastMessage: '',
toastClass: ''
@@ -119,6 +121,33 @@ class BrowserLogInFormContainer extends Component {
});
}

_unthrottledHandleForgotPassword = (e) => {
e.preventDefault();
const { email } = this.state;

// validate the email and password
if (!validateEmail(email)) {
this.setState({
emailError: true,
});
return;
}

const { actions } = this.props;
actions.resetPassword(email)
.then((success) => {
if (success) {
actions.setToast({
toastMessage: t('banner_check_your_email_title'),
toastClass: 'success',
});
}
});
}

// eslint-disable-next-line react/sort-comp
_handleForgotPassword = throttle(this._unthrottledHandleForgotPassword, 10000)

/**
* React's required render function. Returns JSX
* @return {JSX} JSX for rendering the Log In View of the Hub app
@@ -142,6 +171,7 @@ class BrowserLogInFormContainer extends Component {
passwordError={passwordError}
handleInputChange={this._handleInputChange}
handleSubmit={this._handleLoginAttempt}
handleForgotPassword={this._handleForgotPassword}
/>
);
}
@@ -15,7 +15,12 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import BrowserLogInFormContainer from './BrowserLogInFormContainer';
import { login, getUser, getUserSettings } from '../../../Account/AccountActions';
import {
login,
getUser,
getUserSettings,
resetPassword
} from '../../../Account/AccountActions';
import { getTheme } from '../../../panel/actions/PanelActions';
import { setToast } from '../AppView/AppViewActions';

@@ -39,7 +44,8 @@ const mapDispatchToProps = dispatch => ({
login,
getUser,
getUserSettings,
getTheme
getTheme,
resetPassword
}, dispatch),
});

ProTip! Use n and p to navigate between commits in a pull request.