When both properties are needed during registration, but only one is necessary after, the system utilizes Firebase built-in functions for authentication and registration purposes. All other information will be stored in the Firebase user collection.
The issue arises when there are two types of users: one for registration with a password, and another general type without:
export interface RegistrationUser extends firebase.UserInfo {
email: string;
password: string;
}
export type User = Omit<RegistrationUser, 'password'>;
registerUser(user: RegistrationUser) {
this.auth.createUserWithEmailAndPassword(user.email, user.password).then(()=> {
let newUser = user as User;
// save user prop to firebase user collection
this.collection.add(newUser);
});
}
Even with the 'as' keyword, the password
property is still being saved. How can I prevent the password from being stored in the user collection?
Thank you.