Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.inviteUser = functions
- .region('europe-west1')
- .https.onCall(async (data, context) => {
- let company = await getCompanyNameFromUserId( context.auth.uid )
- const { fullname, email, userId, password } = data;
- let user = await Auth.createUser( {
- email: email,
- password: 'ARi5phie'+Math.random()
- }
- );
- console.log(company + " this is company");
- const userData = {
- userId: 'userId-' + user.uid,
- fullname,
- email,
- password,
- company,
- role: 'user',
- roleIn: 'invited',
- logo: '',
- dateAcceptedTOC: Date.now(),
- };
- await companyApi.addUserToCompany(company, email, user.uid, 'invited', fullname, firestore);
- return userApi.createAccount(userData, firestore);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement