Voting without user log in - how to limit votes to 1 per session?

I want visitors of the website to submit votes without needing to log in. I don’t however, want them to be able to vote over and over again by simply refreshing the page. As a web dev, I’d set a cookie or local storage to save if the user already voted for a particular item. That way, it isn’t so obvious as to how you can abuse the voting system.
Is there any way to do this well? I tried the local storage plugin but it actually caused bugs when I tried to check if a certain item was in local storage with in a conditional statement…

Hi!

Bubble is like other languages, and has its peculiarities. So keep trying with cookies.

Bubbe will save data about the user even if they are not logged in, however they will be able to vote again in a different browser or on another device.

In your case:

You can create a new database field on the user data type:
Name: Voted? Type: yes/no with a default “no”

When the (logged out) user votes you can make changes on current users “voted?” to “yes” and they won’t be able to vote again after refreshing the page even though they aren’t logged in

1 Like

This is what Bubble does (solution above) but doesn’t tell you :grinning: because you don’t NEED to know.

Don’t overthink it :slight_smile: :slight_smile: