Skip to content

Commit

Permalink
add recaptcha and formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
farminf committed Jan 11, 2018
1 parent 620e4e9 commit 707a4db
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"react": "^16.2.0",
"react-dates": "^16.0.1",
"react-dom": "^16.2.0",
"react-icons": "^2.2.7",
"react-recaptcha": "^2.3.5",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>

<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
1 change: 1 addition & 0 deletions src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class LoginUserNamePassword extends React.Component {
<Button onClick={this.onLoginWithEmail} raised className={classes.button}>
Login
</Button>
{this.state.error && <p>{this.state.error}</p>}
</form>
</Paper>
)
Expand Down
8 changes: 8 additions & 0 deletions src/components/LoginGoogle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {withStyles} from 'material-ui/styles';
import Constants from '../utils/constants'
import Paper from 'material-ui/Paper';
import Typography from 'material-ui/Typography';
import FaGoogle from 'react-icons/lib/fa/google-plus-square';


const styles = theme => ({

Expand All @@ -24,6 +26,10 @@ const styles = theme => ({
marginLeft: 20,
marginRight: 20
})
,
googleicon:{
marginRight : 5
}
});

const LoginGoogle = (props) => {
Expand All @@ -41,7 +47,9 @@ const LoginGoogle = (props) => {
Login With Google
</Typography>
<Button onClick={props.onLoginGoogle} raised className={classes.button}>
<FaGoogle size={30} color='red' className={classes.googleicon}/>
{Constants.ASSIGNS_LOGIN}

</Button>

</Paper>
Expand Down
25 changes: 17 additions & 8 deletions src/components/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {withStyles} from 'material-ui/styles';
import Paper from 'material-ui/Paper';
import Typography from 'material-ui/Typography';
import TextField from 'material-ui/TextField';
import Recaptcha from 'react-recaptcha';

const styles = theme => ({

Expand Down Expand Up @@ -51,11 +52,8 @@ class SignUp extends React.Component {

onSignup = (e) => {
e.preventDefault();
if (!this.state.email || !this.state.password || !this.state.confirmpassword ||
!this.state.email.match(/^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)) {
this.setState(() => ({
error : 'All field should be filled'
}));
if (!this.state.email || !this.state.password || !this.state.confirmpassword || !this.state.email.match(/^(([^<>()\\.,;:\s@"]+(\.[^<>()\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)) {
this.setState(() => ({error: 'All field should be filled in the correct way'}));
} else {
this.setState(() => ({error: ''}));
this
Expand All @@ -66,8 +64,14 @@ class SignUp extends React.Component {

onEmailChange = (e) => {
const email = e.target.value;
//if (!email || email.match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)) {
this.setState(() => ({email}));
// if (!email ||
// email.match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\
//
//
//
// [[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-
// Z ]{2,}))$/)) {
this.setState(() => ({email}));
//}

};
Expand All @@ -87,7 +91,7 @@ class SignUp extends React.Component {
return (

<Paper className={classes.paper} elevation={4}>
{this.state.error && <p>{this.state.error}</p>}

<Typography type="body1" component="p">
Create New Account
</Typography>
Expand Down Expand Up @@ -115,9 +119,14 @@ class SignUp extends React.Component {
alue={this.state.confirmpassword}
onChange={this.onConfirmPasswordChange}/>

<Recaptcha
className={classes.textField}
sitekey="6Lc1_j8UAAAAAH5zKYdv055fpSrIDghc3J6xZF02"
/>
<Button onClick={this.onSignup} raised className={classes.button}>
Register
</Button>
{this.state.error && <p>{this.state.error}</p>}
</form>
</Paper>
)
Expand Down
8 changes: 4 additions & 4 deletions src/containers/Accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const styles = theme => ({
},
root: {
flexGrow: 1,
marginTop: 30,
marginRight: 30,
marginLeft: 30,
marginTop: theme.spacing.unit,
marginRight: theme.spacing.unit,
marginLeft: theme.spacing.unit,
textAlign: 'center'
},
paper: {
Expand Down Expand Up @@ -53,7 +53,7 @@ class AddAccountContainer extends React.Component {
<div>

<div className={classes.root}>
<h1>{Constants.ADD_ACCOUNT_PAGE_TITLE}</h1>
<h2>{Constants.ADD_ACCOUNT_PAGE_TITLE}</h2>
<Grid container spacing={8}>

<Grid item md={4} xs={10} sm={5}>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CategoriesContainer extends React.Component {
<div>

<div className={classes.root}>
<h1>{Constants.ADD_CATEGORY_PAGE_TITLE}</h1>
<h2>{Constants.ADD_CATEGORY_PAGE_TITLE}</h2>
<Grid container spacing={8} className={classes.rootgrid}>

<Grid item md={4} xs={10} sm={5}>
Expand Down
3 changes: 1 addition & 2 deletions src/containers/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import {withStyles} from 'material-ui/styles';
import Paper from 'material-ui/Paper';
import Grid from 'material-ui/Grid';
import Constants from '../utils/constants';
import AccountList from '../components/AccountList';
import TransactionList from '../components/TransactionList';
import CategoryList from '../components/CategoryList';
Expand Down Expand Up @@ -61,7 +60,7 @@ class Dashboard extends React.Component {
const {classes} = this.props;
return (
<div>
<h1>{Constants.DASHBOARD_PAGE_TITLE}</h1>
{/*<h2>{Constants.DASHBOARD_PAGE_TITLE}</h2>*/}
<div className={classes.root}>
<Grid container spacing={8} className={classes.rootgrid}>

Expand Down
1 change: 1 addition & 0 deletions src/containers/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import LoginGoogle from '../components/LoginGoogle';
import SignUp from '../components/SignUp';
import LoginUserNamePassword from '../components/Login';


const styles = theme => ({

button: {
Expand Down
8 changes: 4 additions & 4 deletions src/containers/Transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const styles = theme => ({
},
root: {
flexGrow: 1,
marginTop: 30,
marginRight: 30,
marginLeft: 30,
marginTop: theme.spacing.unit,
marginRight: theme.spacing.unit,
marginLeft: theme.spacing.unit,
textAlign: 'center',
},
paper: {
Expand Down Expand Up @@ -52,7 +52,7 @@ class AddTransactionContainer extends React.Component {
<div>

<div className={classes.root}>
<h1>{Constants.ADD_TRANSACTION_PAGE_TITLE}</h1>
<h2>{Constants.ADD_TRANSACTION_PAGE_TITLE}</h2>
<Grid container spacing={8}>

<Grid item md={4} xs={10} sm={11}>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Constants = {
ASSIGNS_LOGOUT : "Logout",
TEXT_LOGIN_CARD_HEADER : 'Welcome to Family Finance',
TEXT_LOGIN_CARD_BODY : 'Login to your area',
ADD_ACCOUNT_PAGE_TITLE : 'Account',
ADD_ACCOUNT_PAGE_TITLE : 'Accounts',
ADD_TRANSACTION_PAGE_TITLE : 'Transactions',
ADD_CATEGORY_PAGE_TITLE: 'Categories',

Expand Down

0 comments on commit 707a4db

Please sign in to comment.