Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hint Google Smart Lock to use a specific input field as the username in a website

I've been trying to search for some documentation on how to hint Google Smart Lock for Chrome to use a specific input field as the one associated with the username without any luck.

For the password it works perfectly as it is using type="password" but when it comes down to the username in a multi field form, where the username is not specified before the password or not as the first field in the form it picks another of the fields in the form as the username.

Does anyone have any clue on how to hint Google Smart Lock to use a specific input field as the username?

like image 551
Lluís M. García Avatar asked Mar 08 '16 09:03

Lluís M. García


2 Answers

Google smart lock is a build-in feature of chrome, there is the same function on firefox. It based on the last input type="password" to detect password field would be saved. Here are some things I have tested on FireFox and Chrome

  1. Chrome:
    • Based on the last input type password (you even have more than 2 input password elements)
    • If 2 last input type password has the same value -> decide to save password
    • Look up to find an upper input type text from the first input type password (Not a hidden type nor disabled) to pick it as username
  2. Firefox:
    • Based on the last input type password (you even have more than 2 input password elements)
    • If 2 last input type password has the same value -> decide to save password
    • Look up to find an upper input type text from the first input type password (Not a hidden type) to pick it as username, note that FF allow input disabled is an username :)
like image 67
Davis Avatar answered Oct 13 '22 11:10

Davis


You just need to put:

autocomplete="username"

on the required field (usually the user's email, or site's user name).

then it will know to use it as the key to the smartlock feature (tested on chrome).

like image 5
shaish Avatar answered Oct 13 '22 11:10

shaish