meumobi / ion-ams-report

0 stars 1 forks source link

Add Email Authentication #3

Closed vdias38 closed 7 years ago

vdias38 commented 7 years ago

https://javebratt.com/ionic-firebase-authentication/ https://progblog.io/Angular-2-Firebase-Tutorial-Part-4-Adding-Email-Password-Authentication/ https://www.firebase.com/docs/web/guide/user-auth.html

vdias38 commented 7 years ago
/*
export interface IUser {
  $key?: string,
  firstName: string,
  lastName: string,
  email: string
}
export class User implements IUser {...}
*/
/src
  /models
    user.model.ts

/*
export class UserProvider {
  create(...) {
    return new User(...)
  }
  update(){}
  delete(){}
  fetchById(){}
  fetchByEditorId(){}
  fetchAll(){}
==? changePassword(){}
}
*/
  /providers
    /user
      user.ts
export class AuthProvider {
  registerUser(...) {
    return this.af2Auth.auth.createUserWithEmailAndPassword(user.email, user.password);
  }
  saveUserData(....) {
    return this.af.database.object('users/' + uid).set({
      name: name,
      email: email,
    });
  }
}
    /auth
      auth.ts

/*
 export class UsersListPage {
  createUser(...) {
    this.userService.create(...)
  }
}
*/
  /pages
    /users-list
      users-list.ts
    /user-form
      user-form.ts
    /login
==? /account
vdias38 commented 7 years ago

ionViewCanEnter: Fired before entering into a view, allows you to control whether the view can be accessed or not (returning true or false).

Source: http://blog.ionic.io/navigating-lifecycle-events/