u12206050 / gridsome-firebase-starter

Frontend Starter for Gridsome & Firebase using Firesync
48 stars 7 forks source link

Example for user registration #10

Closed lesaff closed 4 years ago

lesaff commented 4 years ago

I would love to see an example of email-based user registration on this starter.

Thanks

u12206050 commented 4 years ago

You are welcome to make a pull request, but it should be as simple as creating a view with a login form and then on submit calling something like:

   register() {
      this.$auth.createUserWithEmailAndPassword(this.email, this.password).then(() => {
          this.email = this.password = "";
          this.$auth.currentUser.sendEmailVerification().then(() => {
              //TODO Show message to verify email, redirect to dashboard?
          }, (error) => {
            console.error(error) // TODO show error on form
          })
        }).catch(console.error)
   }