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

Extra #8

Closed
afrinnusrat opened this issue Jun 27, 2018 · 1 comment
Closed

Extra #8

afrinnusrat opened this issue Jun 27, 2018 · 1 comment

Comments

@afrinnusrat
Copy link

afrinnusrat commented Jun 27, 2018

Hi Sir,

I got to see this repo, it's of great use. Thanks for sharing.
I would like to ask if it is possible to add few more fields in this existing signup page.
What would be the process flow and the firebase cloud firestore details(collections)?

Thanks,
Nusrat Afrin

@mitchferguson
Copy link

mitchferguson commented Jun 27, 2018

@afrinnusrat

I would suggest refactoring the form onSignup to pass the entire object form.value pass the email/password into the firebase.auth().createUserWith then the rest into .saveUserInfo(data)

example adding phone number(untested but should put you on the right track):

signup.component.html (include in form)



signup.component.ts

onSignup(form: NgForm) {
this.authService.signupUser(form.value);
}

auth.service.ts

// Signup/register
signupUser(user) {
return firebase.auth().createUserWithEmailAndPassword(user.email, user.password)
.then((result) => {
this.alertService.showToaster('Verification email is sent to you.');
this.userService.verificationUserEmail();
this.userService.saveUserInfo(firebase.auth().currentUser.uid, user);
}
).catch(
error => console.error(error)
);
}

user.service.ts

saveUserInfo(uid, user) {
return firebase.database().ref().child('users/' + uid).set({
name: user.name,
email: user.email,
user: user.phone
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants