Bookmark item with an account

Working through designing the functionality to accomplish the following, any guidance will be appreciated:

  1. While displaying an item I want the user to be able to bookmark it.
  2. The bookmark will open a modal that allows input.
  3. Only registered users can use this functionality.

Stumbling point:

  1. What’s a best practices for verifying identity before opening the modal?
  2. How can the user be redirected to the login page?

Any other tidbits always welcome … Thanks

The way that I would go about it - others may have a better idea.

  1. When a user is logged in, there will be a value inside the security identity. I therefore place the security identity in the workflows globals.

  1. For demonstration purposes, I have created an API action - no actions attached. This demonstrates that all API actions will automatically carry the user ID

  1. A server connect connect on the page is connected to the test API. This makes the user ID available to the page.

  1. When I want the user ID, I pick it from the data bindings.

If the user is not logged in, there will be no value for the user ID. You can use this fact to show a different button for users that are logged in to those that are not. Use a conditional region for this.

When a user is not logged in, the relevant button is clicked on. This can take the user to a login page. There are more elegant ways to handle this part. At least this will give you food for thought.

3 Likes

Thank you @ben - oh, I was so over thinking it.

1 Like

I’ve been working on something a bit unrelated, stupidly I was looking for a users logged in cookie to see if they were logged in or not - Putting the Security provider up in the Global is waaay more efficient, I’m so glad I stumbled on this post - thanks @ben .

@jimed99 Looks like I’m not the only over thinker here :slight_smile:

2 Likes