How to create a user without signing in as the user?

Hi there,

How would I allow a user within the app to create another user without Adalo signing me in as the user I am creating?

Yes, I want an “admin” user to create employees within the app, but when I use the create user sign up form it signs me in as the user. Will I have to make a custom form within input fields and a button? I’d prefer not to.

I currently have them in a collection called employees, but I want the employees to be able to sign in and use the chat functionality that ive built in. Can a user created in an employee collection still engage in user chat?

Hi @sladerose,

I would strongly disagree with @dilon_perera opinion, at least as I understood what was advised.

Based on my experience, I would highly advice NOT to use the collection other than Users to manage User accounts, set passwords, allow users to log in and etc.

With other collection you will end up with a huge mess and problems with data access to this collection, as you will need to be sure that the Current Employee data is available across all app screens; also you will need to check email uniqueness manually; you won’t be able to use built-in password restore, etc.

@sladerose as for your question. Unfortunately it’s not possible just to create a new user with built-in form. Also, you need to allow admin-created users to set passwords somehow. I would advise doing the following:

  • to create a new user, you will need to build a custom form out of input field + button, set input field to type “email”, and it’s better to check that the field isn’t empty
  • to this button you add an action “Create User”. Set email as the value from email field. set password as some random number via RAND function
  • have another field “one-time-code” in Users collection, generate code with the same RAND function (on the same action)
  • if you have Employees collection, most probably you will need relationship to Users and presumably Companies. You can set relationship to Employees at the same time.
    To allow new admin-created user to access the app, you will need to send the code to a user and the screens for him to set the password. This could be done similarly to this password restore video: Adalo tutorials: multistep customized password reset - YouTube

Just my 2 cents.

Best,
Victor

1 Like

Hi Victor:

Thank you for always sharing your vast knowledge.

Quick question. In this case how would you check that the user e-mail does not exists? Use the property, When does this happen? as Sometimes and it will only happen if Users All does not contain the email input? Thanks.

Hi @adominicci,

Well, this is more a business-process question rather than technical one :slight_smile:

When Admin adds a new user to the company in the app, he essentially creates the record, so from the app perspective we don’t have any possibility to check if such user’e email exists or not. We have to trust admin in this case.

Usually it’s possible to get the results if email sending was a success or not from an email messaging provider (like SendGrid or Sendinblue). As for me this will be the only way to check if email exists.

Best regards, Victor.

Hi @Victor I do understand that. My question was more about checking to make sure there’s not a duplicate email in the database. Now that I read my message again I see I wasn’t cleared. :blush:

@adominicci ah ok, I didn’t get that.

The beauty of “Email” field in “Users” database is that it will not allow you to create a record with duplicate email. :slight_smile:
It is a built-in feature and it works 99% of the time (I remember I managed to confuse Adalo somehow with this, but it wasn’t definitely a user-side action).

If you would like to be 100% sure - here are a couple of videos which might be useful:

Best regards, Victor.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.