Create Registration Key for logins

Hello,

I’ve been cracking through the Bubble docs and various interactive guides, courses, youtube videos and have yet to find how to do what I’d like, so hoping the forums can help.

Ultimate End Vision: I want to have a list of custom tokens that are pre-generated by me, and I can invite people into a beta for my app and to actually register, they would put in that token as a “Registration Key”. With a stop gap that each code can only be used a number of times.

I’ve surmised that I can create a thing for beta codes. Each record would contain fields for Code, MaxUses, and Uses.

Where I’m getting stuck: admittedly I’m still trying to wrap my arms around the workflow. My initial though was that I could set a condition if Registration Key’s value = Code from the DB AND Uses are < MaxUses then it would sign the user up. however I can’t seem to get the checks working properly.

Is this possible? if so, what am I missing?

Thank you,

Yes, you’re almost there

First, get this plugin.

Then:

Data Type
Thing : Invite Code

Fields:
Code
Max Uses
Current Uses

Workflow:

Signup Button is Clicked

Step 1: Store Custom Data Type Invite Code source = Do a Search for Invite Code where Code = Input Invite Code's Value 's first item 's Current Uses

Step 2:
Sign the user up
WHEN Step 1's Invite Code's Current Uses < Step 1's Invite Code's Max uses

Make Changes to a thing: Invite code: Step 1's Invite Code
Thing to change: Current Uses = Step 1's Invite Code 's Current Uses +1

Step 3:
Show Alert
WHEN Step 1's Invite Code's Current Uses Step 1's Invite Code's Max uses

That should be enough to do what you’re trying to acheive, let me know if that helps or if there’s a further nuance

I’m getting through but struggling.

When I tried setting up your example, I’m storing the current uses of the first item in step 1. I understand this as it would only return a value from the first row if it matches the invite code’s code.

So step 1 should effectively store the number 0. as the key has no uses.

However in subsequent steps when referencing step 1’s result, the when trigger doesn’t seem to be triggering properly when comparing it to Max Uses. I think this is because step one only pulls Current Uses and no other data points to compare?

running the debugger though it shows uses as (empty)…

to provide more context from the above.

image

The debugger shows the appropriate input for the invite code, but also shows (empty) for the search at the bottom. I’ve copied it directly from the App data row I’d like to use.

image

I am unsure what else to look into to figure this out

Might be a privacy rule issue. Otherwise need to dig into this to see what’s really happening.

It was! thank you!

Once that was figured out I also found that I had to store the CurrentUses and MaxUses separately and compare the stored numbers. but everything works great.

Appreciate your insight, this definitely helped me understand workflows with App Data a lot better.

1 Like