Skip to content

Commit

Permalink
Fixes #12 Make a redirection page #13 #14 (#16)
Browse files Browse the repository at this point in the history
* Fixes #14 and #13
  • Loading branch information
Tlazypanda authored and subClassy committed Jan 23, 2018
1 parent 4dd493b commit f19cb77
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 14 deletions.
15 changes: 13 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,24 @@ h2 {
font-weight: 25;
}

.centre{
font-family: cursive;
padding: 100px;
}
.SignIn-Box, .signup-box {
background: #12494f;
box-shadow: 9px 9px 10px 1px rgba(12, 46, 49, 0.76);
padding: 3em;
padding-top: 1em;
}

.Verify-Box {
background: #12494f;
box-shadow: 9px 9px 10px 1px rgba(12, 46, 49, 0.76);
padding: 3em;
padding-top: 1em;
}

.signin-form, .signup-form {
padding-top: 2em;
width: 30%;
Expand All @@ -56,9 +67,9 @@ h2 {

.email-input, .password-input, .name-input{
outline: none;
font-size: 2em;
font-size: 1.2em;
color: #e8e8e8;
padding: .8em 1em;
padding: 1.6em 1em;
margin: auto;
border: none;
-webkit-appearance: none;
Expand Down
10 changes: 3 additions & 7 deletions src/components/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Label } from 'bloomer/lib/elements/Form/Label';
console.log(error);
this.setState({error});
})
window.location.reload();
}

resetemail()
Expand Down Expand Up @@ -121,13 +122,8 @@ import { Label } from 'bloomer/lib/elements/Form/Label';
>
SIGN IN
</button>
<button
className = "btn signin-btn"
type = "button"
onClick = {() => this.resetemail()}
>
Forgot Password
</button>
<hr />
<p className = "signup-link"><Link onClick = {() => this.resetemail()} className = "link">Forgot Password</Link></p>
<hr />
<p className = "alt-signin"> Sign In Using : </p>
<div className = "oAuth-btns">
Expand Down
60 changes: 60 additions & 0 deletions src/components/emailverify.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React,{Component} from 'react';
import { Box } from 'bloomer';
import ReactDOM from 'react-dom';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { Router, Route, browserHistory, hashHistory } from 'react-router';
import { firebaseApp } from '../firebase';
import { logUser } from '../actions/index';
import reducer from '../reducers';
import '../App.css';
import App from './App';
import SignIn from './SignIn';
import SignUp from './SignUp';


class emailverify extends Component {
constructor(props) {
super(props);

const store = createStore(reducer);
var user = firebaseApp.auth().currentUser;
firebaseApp.auth().onAuthStateChanged(user => {
if(user) {
console.log(user.emailVerified);
const { displayName } = user;
const email = displayName;
store.dispatch(logUser(email));
if(user.emailVerified) {

window.location.href('/app');
}
}
else {
window.location.reload();
}
});

}



render(){
return (
<div className="centre">
<Box className = "Verify-Box">
<h1>You have not verified your email yet.Sorry folks.Kindly check your inbox and verify for account activation </h1>

<button
className = "btn signup-btn"
type = "button"
onClick = {() => window.location.reload()}
>
Try Again
</button></Box></div>

)
}
}

export default emailverify;
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import reducer from './reducers';
import App from './components/App';
import SignIn from './components/SignIn';
import SignUp from './components/SignUp';
import emailverify from './components/emailverify';
import '../node_modules/font-awesome/css/font-awesome.min.css';

const store = createStore(reducer);
Expand All @@ -23,11 +24,8 @@ firebaseApp.auth().onAuthStateChanged(user => {
if(user.emailVerified) {
hashHistory.push('/app');
} else {
alert('Please check your inbox for a verification e-mail and follow the instructions');
user.sendEmailVerification().then(function() {
hashHistory.replace('/signin');
});
}
hashHistory.replace('/emailverify');
}
}
else {
hashHistory.replace('/signin');
Expand All @@ -38,6 +36,7 @@ ReactDOM.render(
<Provider store = {store}>
<Router path = "/" history = {hashHistory}>
<Route path = "/app" component = {App} />
<Route path = "/emailverify" component = {emailverify} />
<Route path = "/signin" component = {SignIn} />
<Route path = "/signup" component = {SignUp} />
</Router>
Expand Down

0 comments on commit f19cb77

Please sign in to comment.