Forum Academy Marketplace Showcase Pricing Features

Disabling a user in the user table

I am looking at incorporating a solution where I can disable a user in the user table.

This will mean we can stop the user logging into the system but be available for other parts of the solution.

I have added a new field called “login enabled” but when clicking on the login button and doing a search for the user table using the email and field contents it seems to ignore searching this table.

I tried creating a table manually with email and the same field and when doing a search on this table it appeared to work.

I dont want to have a second table but has anyone managed to get the field working in the user table to stop users being able to be logged in and display a message on the front end.

Driving me mad now :slight_smile: but trying a second table seems to prove that this is related to the user table and maybe some level of protection on it? The debug mode seems to show that the values (email and search for entry) are displayed but the ‘do a search for’ doesnt seem to use them!

Any help would be massively appreciated!

Thanks,

Hi P_clavering,

I’ll try assist you with this.

You could literally just put on the login button "Only when input email is not “[email protected]” and have a popup that’s hidden on page load that displays your message "Only when input email is “[email protected]ail.com”.

You could do it differently again (and a better way) by creating a datatype (I assume that’s what you’re referring to when you say tables) called “Blacklisted/Disabled” and a field called “Blacklisted/Disabled Email” and include emails in that. and on the login button when clicked have “Only when” choose “Do a search for Blacklisted/Disabled” and have the constraints “Blacklisted/Disabled Emails doesn’t contain this Email inputs value” (Email inputs value is the input on your page they enter their email into before they click login) and then continue as normal “Go to page bla” for those that aren’t blacklisted. Now do the same again above (copy and paste the workflow) and choose "Only when “Do a search for Blacklisted/Disabled” and have the constraints “Blacklisted/Disabled Emails DO contain this Email inputs value” and then do “Show Pop up 1” and create Pop up 1 saying your message to blacklisted/disabled users (which doesn’t go to any page). Have Pop up 1 hidden on page load.

Hope that helps!

Hi,

I have tried the second way to create a new datatype and add both the user object and email. This works well however I would ideally like to maintain one datatype (User) rather than have two.

Thanks for your help. I am presuming it is not possible to use the user datatype to do this?

Thanks

Yes, you can do it using the User data type but I was assuming you didn’t want to allow a person with a certain email to even become a user. For those that are already users do the following:-

Create a new field in the User datatype called “Pages” and have it as a list. Add every page name they’re not allowed to access. For the example below I’ll assume your page is GARDENING SECRETS so you add GARDENING SECRETS to the User’s Pages field.

Then on the LOGIN button or the button that will take the user to the page in question have a workflow that does this “Only when current user’s pages does not contain GARDENING SECRETS go to Gardening Secrets page” duplicate the workflow and have “Only when current user’s pages DOES contain GARDENING SECRETS” and then have “show Pop up 1” with no go to any pages. Have Pop up 1 hidden on page load.

You do this for every page in question that you want to restrict access depending on the user.

You could have a User field called “AccessCode” or something and have for example an 8 digit code. And do the above but instead of pages say “Only when current user’s access code is 82918382” for example. Or you could have a toggle that’s yes or no. Or you could create tier access, 3 fields “Level 1 access” “Level 2 access” “Level 3 access” with either yes or no. And on the restricted pages have “Only when current user’s level 3 access is YES.” to allow access to that page or one field called AccessLevel and numbers 1,2,3,4 with “Only when current user’s AccessLevel is 3 go to restricted page” and so forth. Many ways of doing it.

I tried to recreate @p_clavering’s use case when I saw this post, and I wasn’t able to get an only when condition to work on a field that is in the User data type either. If you can get it to work, @tzuork, maybe you can post an example and show us what we doing wrong because I am as stumped as @p_clavering is.

Best…
Mike

I’ve just done what @p_clavering is trying to do I think…

When the user logs in with your login button ALLOW them to log in, so have when LOGIN button is clicked, log in user, but the next action in the same workflow needs to be GO TO Only when Current User’s login enabled is YES and have that go to whatever page you want and then the next action in the workflow, Show Pop up 1 with Only When Current User’s Login enabled is NO and the final action Log User Out with ONLY WHEN Current User’s Login enabled is NO. That’ll do what you want too.

Ah, so you can’t stop the user from logging in, but you can redirect them after the successful login based on a field in the User data type, eh? Maybe you can’t access any fields in the User data type other than the email address until after the user is logged in, and that’s why you can’t put the condition on the login action itself?

I’ve also just done it via Only when Do a search for Users’s email contains email inputs value with the constraints Log in enabled = yes

I also did it with this too “Only when email input’s value doesn’t contain email 1 or email 2 or email 3 or email 4 or email 5 or email 6 or email 7”

Both also worked :slight_smile:

I could have sworn I couldn’t get it to work with that search, and I think that’s what @p_clavering was saying, too, but maybe I just messed it up. Oh, well. :slight_smile:

Hi @mikeloc and @tzuork looks like an interesting conversations. I am not keen on a user logging in if they are disabled. Its quite a complicated site and I use the ‘check the user is logged in’ many times.

I could not get this to work at all @tzuork

I’ve also just done it via Only when Do a search for Users’s email contains email inputs value with the constraints Log in enabled = yes

I think I have two options…

  1. have a second data type that contains only values that are ‘allowed’ to login. The check on the login button will work on this second type BUT the down side is data in two places - not ideal

  2. Keep the user table, user logs in but then if not enabled I could display a message and log them straight out. This doesnt sound like a good approach either.

Can you show a demo @tzuork of it working so I can copy it?

Thanks both :slight_smile:

1 Like

Sure, I’ve managed to do exactly what you’re looking to do now mate. I’ll add some screenshots now.

1 Like

Maybe add another step in the workflow that logs the user out if they are inactive and the step before that might be to show an element that tells them what is going on.

edit: Yup, this worked for me. Maybe consider some security, maybe have the login page separate from the stuff you dont want them to access. Or have it hidden on page load.

First have when your button Login is clicked, Log the user in

Do "Search for user’s email contains input emails value with the constraint “login enabled = yes”


232

Set a state on the page for example “state 1 = value no” Only when Search for users email DOESN’T contain input emails value with the constraint again as login enabled = yes.

On your pop up message have state 1 contains no, the pop up is visible. state 1 doesn’t contain no, isn’t visible.

That does what you’re looking to do and is the safest way as it doesn’t log the user in unless login enabled = yes :slight_smile: - remember to tick 'not visible on page load on your pop up too.

Hi @tzuork,

tried this again with exactly the same as you but when I run the debug I get the following…

Notice the red saying its not a match
Screenshot 2020-12-20 at 21.50.06
The evaluator is showing the email is blank even though login enabled it yes.
Screenshot 2020-12-20 at 21.51.00

I wonder if there is some additional controls I have on my user type

I’ve just checked my debugger and mine works perfectly.

Send me some screenshots like I did above so I can double check everything or allow me access if it’s easier via the collaboration section for 5 mins and I’ll fix it for you :slight_smile:

This is mine for login enabled:-

This is mine for login not enabled:-

1 Like