How to pre-fill the log-in email input

Users are being logged out of my app more frequently than I’d like. The hardest part about logging back in is typing in an email address from scratch. If the email was pre-filled then it would just be a matter of clicking a single button.

I setup this workflow and custom state to try to capture the user’s email when they log in and put it into the email field so that it will still be there when they’re logged out.

It doesn’t work and I suspect that because everything is linked to “current user” that it’s getting emptied out when the “current user” is logged out.

Is there a way to put the text of the user’s email into a field while they’re logged in, so that when they’re logged out the text of their email will still be in the field?

Do you have ‘yes’ as the value for “Remember the email” when the User logs in?


I’m not actually using the “log the user in” action. I’m using the “reset password” action to provide a passwordless UX

Ohh, hmm… I’m not sure if this would work, but each time before the User is logged in action - can you create an action in the workflow which saves the email value to the Current User when they’re logged out (an extra field within the User such as “easy_email” type: text). Then, set that to be the initial content of the input when the User is logged out? I think this would save it as a cookie when the User is Logged out

Do you mean “logged out” as in the “log user out” action? That hasn’t been what’s kicking users out. They just get booted every now and then. I assume it’s Bubble updating itself or something like that about the platform.

Does the suggestion to replicate the user’s email in a second field imply that Bubble treats built-in fields differently than non-built-in fields? It’s already set to the user’s email, which is already a text field. The only difference would be that the new field is a clone of a built-in field.

To confirm, in your app’s ‘log the User in’ action, the Email value is from the API, not from an input - correct? I think this is why the initial content isn’t displaying inside of the email input, even though you have ‘remember email’: “yes”.

Is there a way you can change the value of the “Log the User in” email login to be the input’s value, instead of the API’s “email” value? My thought was that if you can’t do that, then to save the email to the Logged Out User (which is separate from the User when they are logged in; it’s saving it to the browser). Data can be saved to Users who are not logged in, but not to the built-in email and password fields, which is why I suggested adding the “easy_email” field as a workaround.

How can I save something to the logged-out-user while the user is still logged in? Are non-built-in fields available when the user is logged out?

After the user is already logged out the workflow can’t access their email to put it anywhere else.

The input field’s initial value can’t access a logged-out user’s email either

It’s saving it when the User is logged out. For example,

I go to your app for the first time and enter my email to log in. After your passwordless workflows run - before the action where I am officially logged in - create a new action which is "Make Changes to Current User --> Field to Change: easy-email = “email” (from the API). Then the following action is “Log the User In”.

Then I log out, close the browser, and reopen the browser. The email input’s initial content is “Current User’s easy_email”, which is the email I had entered previously to log in to your app.

It’s not a perfect solution, since the cookie will expire (not sure after how long). If you could have the email be the value of the input when the User is being logged in, that would work best.

On a related note…any idea how to open the reset_pw page in debug_mode? I tried adding “&debug_mode=true” to the end of the link but that doesn’t work.

Okay, so, again, there is no “log the user in” action. I’m only using the password reset functionality, which logs the user in using the “reset password” action.

I just tried adding a “make changes to a user” action before the password is reset, but as expected, since they aren’t logged in yet they don’t have access to user data, so nothing in the user’s thing changes.

I’d like to hear more about these cookies. How are cookies written and read? Is there a way to control it? Can I tell Bubble to put data into a cookie and then use that data later in my expressions?

I’m referring to this “log the User in” action from your previous post here:

And correct, easy_email isn’t saved to that User’s account; it’s saved temporarily as a cookie completely separate from that User’s actual account (you can’t view temporary User data in the database view). I am not very familiar with cookies myself, aside from the posts in the forum which discuss them. At the moment, I don’t believe we can control them.

In order to view a page in debug mode, I think the value needs to be “?debug_mode=true”.

I’m not worried about any of the APIs. I’m worried about the user having to type their email address in every time they want to log in to the web app. There aren’t even any elements, let alone input elements, involved in the APIs.

The debug_mode parameter is likely being treated as a parameter for the clickrouter. Try url-encoding the & symbol so it is passed into the url parameter. Or the ? symbol as @fayewatson points out.

1 Like

Hey, that did work, thanks! I used %26 instead of & and the reset_pw page loaded in debug mode.

@mishav do you have any suggestions about how to have a User’s email ‘remembered’ as the initial content of an input, even though the log in action is happening within an API Workflow?

Haha yeah I answered the easy part.

As @fayewatson mentions, Bubble uses a cookie for storing guest user info, expires in three days as per Emmanuel. This probably won’t be useful, as I don’t think it stores info when logged in.

What you are after is accessing “Browser storage”, there are a few types, with various pros and cons. Generally it would need some javascript. I haven’t played with it yet from within Bubble, but here are some ideas …

Or there are some javascript libraries:

1 Like

An alternative is to have a text input with auto remember history turned on, like the opposite solution to this post:

1 Like

Oh no, I didn’t mean it like that :sweat_smile: I just knew you would have a better idea of what to do! Thank you for the info : )

@emmanuel Looks like this is a good time to ask if we’re missing something. Is there a way to have the initial content of an input field remember the user’s email after the user is logged out?

I have a field in my new app the prefills the email address. I hope that’s what you are looking for. By the way, you need to have remembered me checked.

I think what you need to do after that is have a workflow run on page load that says something like this. When current user email is not empty then…

@emmanuel So, I do have “remember the email” checked in the signup action. That’s all the reference says is necessary to get the browser to remember their email.

Is there another way to “remember” the user’s email every time they log in, other than the “log the user in” action?

More specifically, is there a way to remember the email during the password reset process?
The “send password reset email” action doesn’t have a remember option

Neither does the “reset password” action, but Bubble must know what email address is associated with the token, otherwise this process wouldn’t work.