Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Safari know when to prompt user to save password?

This related to How does browser know when to prompt user to save password? except mine is specific to Safari.

I have a website in which there are two different ways you can log in. The first is the main site in which you have to enter your email, password, and your account's domain. The second way is to actually go to your domain (which is pointing at my server) at which point you're only asked to enter in your email and password.

Logging in the second way (two inputs), Safari, Chrome and Firefox will all ask if I'd like to save my username and password (as expected).

But logging in the first way (three inputs), only Chrome and Firefox ask. Safari does not.

My form is not AJAX/Javascript. It has a form tag, a submit button, and three inputs with the ids/names - email, password (of type=password), and account_domain. I do not have autocomplete=off.

Does anyone know what Safari is looking for to ask to save username/passwords? Is it b/c I have three inputs instead of two?

As a note, I ran the same test on my wife's Mac using Safari only and she wasn't prompted to save in either case. So I don't know.

I verified that neither of us had clicked "never remember passwords" for either of these sites.

like image 348
pcg79 Avatar asked Jul 17 '12 18:07

pcg79


People also ask

How do I force Safari to suggest a password?

In the Safari app on your Mac, when a website asks you to create a password, click the password field. Click the AutoFill Key button , then choose Suggest New Password. A strong password is suggested for you, with a yellow background.

How do you stop Safari asking if I want to save password?

Ensure that the switch next to AutoFill Passwords is turned ON, if it's not already. Note: in iOS 11, you need to go to Settings → Safari → AutoFill → Turn on the switch next to Names and Passwords. From now onwards, when you visit any site and log in, Safari will ask you to save the passwords.

Why isn't my iPhone asking me if I want to save passwords?

iOS 14 or later: Go to Settings > Passwords > AutoFill Passwords. Check that AutoFill Passwords is turned on. iOS 12 or 13: Go to Settings > Passwords & Accounts > Website & App Passwords. Check that AutoFill Passwords is turned on.


1 Answers

I was having this same issue, and your post answered my problem.

I just had a simple form that only requested a password, which would not prompt Safari on a mobile to save the password:

<fieldset>
<legend>Please login below:</legend>
<form role="form" id="access" name="access" method="post">
    <div class="form-group form-group-sm">
        <label for="password">Password</label>
        <input class="form-control" required type="password" placeholder="Enter Password" name="password" id="password" />
    </div>
    <div class="form-group form-group-sm">
        <input class="btn-lg btn-primary center-block" type="submit" value="Login" />
    </div>
</form>

After reading your post, I added a "username" input field as follows:

<fieldset>
<legend>Please login below:</legend>
<form role="form" id="access" name="access" method="post">
    <div class="form-group form-group-sm">
        <label for="username">Username</label>
        <input class="form-control" required type="text" placeholder="Enter Username" name="username" id="username" />
    </div>
    <div class="form-group form-group-sm">
        <label for="password">Password</label>
        <input class="form-control" required type="password" placeholder="Enter Password" name="password" id="password" />
    </div>
    <div class="form-group form-group-sm">
        <input class="btn-lg btn-primary center-block" type="submit" value="Login" />
    </div>
</form>

After adding that, I now got a prompt to save the password.

So I think Safari is looking for a username, name, email, etc. to tie along with a password field. I didn't test this too much, but I'm sure someone with more experience can verify that.

Thanks for your post.

like image 62
David Avellan Avatar answered Dec 11 '22 19:12

David Avellan