Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
subClassy committed Jan 17, 2018
1 parent 4fb6c4c commit 4dd493b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/components/SignUp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ class SignUp extends Component {
}

signUp() {
console.log(this.state);
const {email, password,name} = this.state;
firebaseApp.auth().createUserWithEmailAndPassword(email, password)
.then(() => {
var user = firebaseApp.auth().currentUser;
firebase.database().ref('users/' + user.uid).set({
username: name,



username: name,
});
user.sendEmailVerification().then(function() {
console.log("verification email sent")
Expand Down
21 changes: 9 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@ const store = createStore(reducer);

firebaseApp.auth().onAuthStateChanged(user => {
if(user) {
console.log(user.emailVerified);
const { displayName } = user;
console.log(user.emailVerified);
const { displayName } = user;
const email = displayName;
store.dispatch(logUser(email));
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.push('/app');
} else {
alert('Please check your inbox for a verification e-mail and follow the instructions');
user.sendEmailVerification().then(function() {
hashHistory.replace('/signin');
});
}
}
else {
hashHistory.replace('/signin');
Expand Down

0 comments on commit 4dd493b

Please sign in to comment.