I am trying to create an ERP type application where the manager will be able to assign things to a particular user in the database through a GUI. As such I would like to replace the random UID generated by firebase using the auth.createUserWithEmailAndPassword with a name variable, I have provided a name input in the login where the employee can enter their name. What is the best way to replace the UID with this name instead?
I am using React.js here is some code snippet:
my auth.js:
import { firebase } from '../firebase/firebase';
export const login = (uid) => ({
type: 'LOGIN',
uid
});
export const newUser = () => {
const username = username.value;
const pass = password.value;
const auth = firebase.auth();
const promise = auth.createUserWithEmailAndPassword(username, pass);
promise.catch(e => console.log(e.message));
};
export const startLogin = (username, password) => {
return () => {
const username = username.value;
const pass = password.value;
const auth = firebase.auth();
const promise = auth.signInWithEmailAndPassword(username, pass);
promise.catch(e => console.log(e.message));
};
};
export const logout = () => ({
type: 'LOGOUT'
});
export const startLogout = () => {
return () => {
return firebase.auth().signOut();
};
};
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
Let me know if there is anything else you need to see to help me.
Thanks.