Skip to content

Commit f19cb77

Browse files
TlazypandasubClassy
authored andcommitted
Fixes #12 Make a redirection page #13 #14 (#16)
* Fixes #14 and #13
1 parent 4dd493b commit f19cb77

File tree

4 files changed

+80
-14
lines changed

4 files changed

+80
-14
lines changed

src/App.css

+13-2
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@ h2 {
2323
font-weight: 25;
2424
}
2525

26+
.centre{
27+
font-family: cursive;
28+
padding: 100px;
29+
}
2630
.SignIn-Box, .signup-box {
2731
background: #12494f;
2832
box-shadow: 9px 9px 10px 1px rgba(12, 46, 49, 0.76);
2933
padding: 3em;
3034
padding-top: 1em;
3135
}
3236

37+
.Verify-Box {
38+
background: #12494f;
39+
box-shadow: 9px 9px 10px 1px rgba(12, 46, 49, 0.76);
40+
padding: 3em;
41+
padding-top: 1em;
42+
}
43+
3344
.signin-form, .signup-form {
3445
padding-top: 2em;
3546
width: 30%;
@@ -56,9 +67,9 @@ h2 {
5667

5768
.email-input, .password-input, .name-input{
5869
outline: none;
59-
font-size: 2em;
70+
font-size: 1.2em;
6071
color: #e8e8e8;
61-
padding: .8em 1em;
72+
padding: 1.6em 1em;
6273
margin: auto;
6374
border: none;
6475
-webkit-appearance: none;

src/components/SignIn.jsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Label } from 'bloomer/lib/elements/Form/Label';
2727
console.log(error);
2828
this.setState({error});
2929
})
30+
window.location.reload();
3031
}
3132

3233
resetemail()
@@ -121,13 +122,8 @@ import { Label } from 'bloomer/lib/elements/Form/Label';
121122
>
122123
SIGN IN
123124
</button>
124-
<button
125-
className = "btn signin-btn"
126-
type = "button"
127-
onClick = {() => this.resetemail()}
128-
>
129-
Forgot Password
130-
</button>
125+
<hr />
126+
<p className = "signup-link"><Link onClick = {() => this.resetemail()} className = "link">Forgot Password</Link></p>
131127
<hr />
132128
<p className = "alt-signin"> Sign In Using : </p>
133129
<div className = "oAuth-btns">

src/components/emailverify.jsx

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React,{Component} from 'react';
2+
import { Box } from 'bloomer';
3+
import ReactDOM from 'react-dom';
4+
import { createStore } from 'redux';
5+
import { Provider } from 'react-redux';
6+
import { Router, Route, browserHistory, hashHistory } from 'react-router';
7+
import { firebaseApp } from '../firebase';
8+
import { logUser } from '../actions/index';
9+
import reducer from '../reducers';
10+
import '../App.css';
11+
import App from './App';
12+
import SignIn from './SignIn';
13+
import SignUp from './SignUp';
14+
15+
16+
class emailverify extends Component {
17+
constructor(props) {
18+
super(props);
19+
20+
const store = createStore(reducer);
21+
var user = firebaseApp.auth().currentUser;
22+
firebaseApp.auth().onAuthStateChanged(user => {
23+
if(user) {
24+
console.log(user.emailVerified);
25+
const { displayName } = user;
26+
const email = displayName;
27+
store.dispatch(logUser(email));
28+
if(user.emailVerified) {
29+
30+
window.location.href('/app');
31+
}
32+
}
33+
else {
34+
window.location.reload();
35+
}
36+
});
37+
38+
}
39+
40+
41+
42+
render(){
43+
return (
44+
<div className="centre">
45+
<Box className = "Verify-Box">
46+
<h1>You have not verified your email yet.Sorry folks.Kindly check your inbox and verify for account activation </h1>
47+
48+
<button
49+
className = "btn signup-btn"
50+
type = "button"
51+
onClick = {() => window.location.reload()}
52+
>
53+
Try Again
54+
</button></Box></div>
55+
56+
)
57+
}
58+
}
59+
60+
export default emailverify;

src/index.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import reducer from './reducers';
1010
import App from './components/App';
1111
import SignIn from './components/SignIn';
1212
import SignUp from './components/SignUp';
13+
import emailverify from './components/emailverify';
1314
import '../node_modules/font-awesome/css/font-awesome.min.css';
1415

1516
const store = createStore(reducer);
@@ -23,11 +24,8 @@ firebaseApp.auth().onAuthStateChanged(user => {
2324
if(user.emailVerified) {
2425
hashHistory.push('/app');
2526
} else {
26-
alert('Please check your inbox for a verification e-mail and follow the instructions');
27-
user.sendEmailVerification().then(function() {
28-
hashHistory.replace('/signin');
29-
});
30-
}
27+
hashHistory.replace('/emailverify');
28+
}
3129
}
3230
else {
3331
hashHistory.replace('/signin');
@@ -38,6 +36,7 @@ ReactDOM.render(
3836
<Provider store = {store}>
3937
<Router path = "/" history = {hashHistory}>
4038
<Route path = "/app" component = {App} />
39+
<Route path = "/emailverify" component = {emailverify} />
4140
<Route path = "/signin" component = {SignIn} />
4241
<Route path = "/signup" component = {SignUp} />
4342
</Router>

0 commit comments

Comments
 (0)