Is it possible to prefill Lock's e-mail field with the previously used e-mail?

Apologies if this has been asked before; I looked and could not find an answer. I am looking to use Lock in a C# application. The Lock widget is prompting those who are looking to use this to provide an e-mail and password. If at all possible, I’d like to prefill the e-mail address with the e-mail that previously logged in (or at least provide an option to remember only the e-mail). Is this possible in Lock’s current state? I have seen the “rememberLastLogin” field, but this does not provide the functionality I’m looking for as far as I can tell.

To be clear, I do NOT want to remember both the e-mail and password. Users should provide their password every time they log in.

Any help is greatly appreciated!

1 Like

From the information provided you seem to be going to use Lock within the client application itself and want to have some control over the data with which Lock is initially shown. If that’s the case, then you should consider taking a look at the prefill option which seems to be applicable to your scenario.

var options = {
  prefill: {
    email: ""

Thanks for the reply! I’ve looked at “prefill” before, but the problem is that I’d need a way to make what I assign to the prefill option variable based on the user. For example, if a new user were to sign in, the prefill option should be blank. After the user signs in once, the e-mail prefill option should be given the value “”. I haven’t yet seen a way to read/write information into Lock’s variables from an external source before, however. Is this possible?

I might be missing something, but assuming the scenario is the user already logged in, but the tokens the application has already expired or you want to trigger authentication again for other reason then your application already knows who the user is before showing Lock, so the prefill seems applicable. Can you be more specific about your usage of Lock? Are you trying to embed it in the application itself with some sort of web browser control or are you using Lock as part of the hosted login page?

(1/3) What I’m trying to do is have the email field of the Lock login window prefilled with the email used during the last successful login. In a real life situation a user may open their application Monday, then close it and log in again on Tuesday. On Tuesday they will need to supply both email and password again. Ideally I’d like to pre-supply their email field as our email addresses are quite lengthy. Just to be clear, this is a C# desktop application which users have installed on their respective laptops. As you guessed, this would happen after the token has expired.

1 Like

(2/3) Prefill doesn’t seem usable here as every user has a different email. I would need to see prefilled and you would need to see prefilled. I’m not sure how I could have the prefill option be dependent on user-specific data like that. Is it possible to read information from a file to Lock? The Lock iteration I’m using is a popup web control for a desktop C# application (apologies if I’m describing this poorly… I’m new to Lock).

(3/3) I have a Hosted Page for my application, but if I hardcode a prefill in the “Hosted Pages” area, won’t it show “” on everybody’s application? I need each individual user to see their own email prefilled, though I’m not sure how to do this. Still, I really appreciate your time! Apologies for the length of this reply… I just wanted to be as clear as possible in what I was looking for.