网页中的登录表单，登录成功后，用户可将用户名和密码保存到系统密码保险箱中。再次打开该网页时，密码保险箱可以提供用户名、密码的自动填充。

## 手机使用场景

以下以<https://developer.huawei.com/>网站为例：

1. 在网站中输入用户名、密码，登录成功后，ArkWeb会提示将用户名和密码保存到密码保险箱中。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/c1/v3/AuzmC7UfROqGpM9W9Hqomg/zh-cn_image_0000002540771594.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=FC0496EE04507A80431A6C5684C538B6D271A2D5BCA59ADF4B301AE355415530)
2. 再次打开相同的网站，点击用户名或者密码框中时，会弹出密码保险箱的填充提示。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/64/v3/bpfumm_ZT7-GcvVPGpDkug/zh-cn_image_0000002571291889.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=0788D1802E855FB764CA28EA61EBC329903C523D764F654E80414EF63677C389)![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/3e/v3/4us5E78kTVKHF8F7l4p0UA/zh-cn_image_0000002540611942.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=F9BDDFEBF08380BB18C857D78C2DAE875C519CAE8399B5A8F69772AA18EE031C)
3. 可以选择提示框中的用户名，通过认证，就能直接在网页中填入之前保存的用户名、密码。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/69/v3/qCObBmCXRbCMd8FilkbjEQ/zh-cn_image_0000002571171937.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=6C1CD960FC87FB18FB59F5853AF15EEA2978451FF1450EB98C9379B4A4DD550E)
4. 点击“使用其他账号”，选择密码保险箱中保存的其他账号。认证后在网页中填入选择的用户名、密码。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/33/v3/pManyweCQpmLl3Hijzov1A/zh-cn_image_0000002540771596.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=A9D5DC190EA6BCBEEBA977483A91DD9D85744B9A776C6FB404AFC42B49735036)![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/a6/v3/wgkZ4s65R9-Kz-hEEtcJsQ/zh-cn_image_0000002571291891.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=AEFBFD0502F9D6EFFE49764FC44DFEC7BB146DF8E23998EC0FDE273E4DA143D9)![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/c0/v3/DJpGKDtqQRKOOkSw9MkwyA/zh-cn_image_0000002540611944.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=B9D60AA30C0D6D285A154477EA8E0F12B190787F79FD233E9C7AD558047D5100)
5. 点击“手动输入”或者提示框之外的地方，会弹出小艺输入法，会提示可用于密码填充的用户名和钥匙图标。

   点击用户名可触发在网页中填入用户名、密码；点击钥匙图标，进入选择账号的界面。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/d1/v3/Mc1noVrcSXWRewecUH5R1w/zh-cn_image_0000002571171939.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=6CE328FAF7402FB27D781CFB4D045036D9A38F60DDCE86081C23B33C97BD3B2F)![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/fd/v3/It29HOF8Q4OKZqSWSzxCQw/zh-cn_image_0000002540771598.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=FCC814BD6580761E4E724C7DC015A8230E0850C86020C2D404CA143C795E2E9C)![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/96/v3/ZmRhQRkpTHiMXF2csqrl_w/zh-cn_image_0000002571291893.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=6FB52C2DCA37CC50B9EA812E69179BE1F09EB4D5841427FEF23B50A12760DFE1)

## 2in1使用场景

以下以<https://developer.huawei.com/>网站为例：

1. 在网站中输入用户名、密码，登陆成功后，ArkWeb会提示将用户名和密码保存到密码保险箱中。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/6c/v3/Sl0K7uBvRCa8wUxuU5htPg/zh-cn_image_0000002540611946.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=19541DCF2BF1BD7BB742D1362C5EBB14A75EE6084E65DFF416AF08A6C3B4A49C)
2. 再次打开相同的网站，点击用户名或者密码框中时，会弹出密码保险箱的下拉框。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/ee/v3/lA6AfcN9RZqQ_0ob2UFc-g/zh-cn_image_0000002571171941.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=4EF4341122C4A3BE7506538335F2C043D4E64F883949CE4CB72059AF68ADB57A)
3. 选择下拉框中的用户名，通过认证，就能直接在网页中填入之前保存的用户名、密码。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/a9/v3/34WpF5mkTQmO8EmmkBJfdg/zh-cn_image_0000002540771600.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=6D6583A3B9423FAF320BCC8F204F76FF19110FB6BBAF49C1B1492FB065FA787B)
4. 也可以点击下拉框中的“使用其他账号”，选择密码保险箱中保存的其他账号。认证后在网页中填入选择的用户名、密码。

   ![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/fb/v3/1uxEBr-dSfGjnHY2Gd0qKg/zh-cn_image_0000002571291895.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=CEC6C168CC09DAFDC62E67B25086EE2C43821A3AD1ADCFE8D40D5048CE45F5F8)

## 网页密码保存规格

1、ArkWeb依赖密码表单提交成功后，触发页面跳转到其他页面，才能触发密码保存。

2、Native应用通过ArkWeb实现H5登入，登录成功后请勿立即销毁ArkWeb实例，否则将无法提示密码保存。

## 网页密码表单规格

ArkWeb使用Chromium智能算法，自动识别网页中的用户名、密码元素。算法对用户名、密码表单的设计，有一定的约束。

### 推荐的密码登录表单

1. 使用静态的登录页面或登录表单元素，而不是通过js脚本在页面中动态插入<form>、<input>等表单元素。
2. 用户名密码输入框均使用<input>元素实现，并集成在同一个<form>内，默认可编辑，登录场景有且最多有一个type="password"类型的<input>元素。
3. 点击按钮触发登录，登录成功后，应当触发跳转到新的页面。
4. 用户名框携带autocomplete=“username”，携带id或name属性，并采用如下建议的值，便于算法推断用户名元素：

   收起

   自动换行

   深色代码主题

   复制

   ```
   1. const char* const kUsernameLatin[] = {
   2. "gatti",      "uzantonomo",   "solonanarana",    "nombredeusuario",
   3. "olumulo",    "nomenusoris",  "enwdefnyddiwr",   "nomdutilisateur",
   4. "lolowera",   "notandanafn",  "nomedeusuario",   "vartotojovardas",
   5. "username",   "ahanjirimara", "gebruikersnaam",  "numedeutilizator",
   6. "brugernavn", "benotzernumm", "jinalamtumiaji",  "erabiltzaileizena",
   7. "brukernavn", "benutzername", "sunanmaiamfani",  "foydalanuvchinomi",
   8. "mosebedisi", "kasutajanimi", "ainmcleachdaidh", "igamalomsebenzisi",
   9. "nomdusuari", "lomsebenzisi", "jenengpanganggo", "ingoakaiwhakamahi",
   10. "nomeutente", "namapengguna"};

   12. const char* const kUserLatin[] = {
   13. "user",   "wosuta",   "gebruiker",  "utilizator",
   14. "usor",   "notandi",  "gumagamit",  "vartotojas",
   15. "fammi",  "olumulo",  "maiamfani",  "cleachdaidh",
   16. "utent",  "pemakai",  "mpampiasa",  "umsebenzisi",
   17. "bruger", "usuario",  "panganggo",  "utilisateur",
   18. "bruker", "benotzer", "uporabnik",  "doutilizador",
   19. "numake", "benutzer", "covneegsiv", "erabiltzaile",
   20. "usuari", "kasutaja", "defnyddiwr", "kaiwhakamahi",
   21. "utente", "korisnik", "mosebedisi", "foydalanuvchi",
   22. "uzanto", "pengguna", "mushandisi"};

   24. const char* const kUsernameNonLatin[] = {
   25. "用户名", "کاتيجونالو", "用戶名", "የተጠቃሚስም",
   26. "логин", "اسمالمستخدم", "נאמען", "کاصارفکانام",
   27. "ユーザ名", "όνομα χρήστη", "brûkersnamme", "корисничкоиме",
   28. "nonitilizatè", "корисничкоиме", "ngaranpamaké", "ຊື່ຜູ້ໃຊ້",
   29. "användarnamn", "యూజర్పేరు", "korisničkoime", "пайдаланушыаты",
   30. "שםמשתמש", "ім'якористувача", "کارننوم", "хэрэглэгчийннэр",
   31. "nomedeusuário", "имяпользователя", "têntruynhập", "பயனர்பெயர்",
   32. "ainmúsáideora", "ชื่อผู้ใช้", "사용자이름", "імякарыстальніка", "lietotājvārds",
   33. "потребителскоиме", "uporabniškoime", "колдонуучунунаты", "kullanıcıadı",
   34. "පරිශීලකනාමය", "istifadəçiadı", "օգտագործողիանունը", "navêbikarhêner", "ಬಳಕೆದಾರಹೆಸರು",
   35. "emriipërdoruesit", "वापरकर्तानाव", "käyttäjätunnus", "વપરાશકર્તાનામ", "felhasználónév",
   36. "उपयोगकर्तानाम", "nazwaużytkownika", "ഉപയോക്തൃനാമം", "სახელი", "အသုံးပြုသူအမည်",
   37. "نامکاربری", "प्रयोगकर्तानाम", "uživatelskéjméno", "ব্যবহারকারীরনাম",
   38. "užívateľskémeno", "ឈ្មោះអ្នកប្រើប្រាស់"};

   40. const char* const kUserNonLatin[] = {
   41. "用户", "użytkownik", "tagatafaʻaaogā", "دکارونکيعکس",
   42. "用戶", "užívateľ", "корисник", "карыстальнік",
   43. "brûker", "kullanıcı", "истифода", "អ្នកប្រើ",
   44. "ọrụ", "ተጠቃሚ", "באַניצער", "хэрэглэгчийн",
   45. "يوزر", "istifadəçi", "ຜູ້ໃຊ້", "пользователь",
   46. "صارف", "meahoʻohana", "потребител", "वापरकर्ता",
   47. "uživatel", "ユーザー", "מִשׁתַמֵשׁ", "ผู้ใช้งาน",
   48. "사용자", "bikaranîvan", "колдонуучу", "વપરાશકર્તા",
   49. "përdorues", "ngườidùng", "корисникот", "उपयोगकर्ता",
   50. "itilizatè", "χρήστης", "користувач", "օգտվողիանձնագիրը",
   51. "használó", "faoiúsáideoir", "შესახებ", "ব্যবহারকারী",
   52. "lietotājs", "பயனர்", "ಬಳಕೆದಾರ", "ഉപയോക്താവ്",
   53. "کاربر", "యూజర్", "පරිශීලක", "प्रयोगकर्ता", "användare",
   54. "المستعمل", "пайдаланушы", "အသုံးပြုသူကို", "käyttäjä"};

   56. const char* const kTechnicalWords[] = {
   57. "uid",         "newtel",     "uaccount",   "regaccount",  "ureg",
   58. "loginid",     "laddress",   "accountreg", "regid",       "regname",
   59. "loginname",   "membername", "uname",      "ucreate",     "loginmail",
   60. "accountname", "umail",      "loginreg",   "accountid",   "loginaccount",
   61. "ulogin",      "regemail",   "newmobile",  "accountlogin"};

   63. const char* const kWeakWords[] = {"id", "login", "mail"};
   ```
5. 登录场景，密码框携带autocomplete=“current-password”。
6. 用户名框下面紧挨密码框，中间不要插入其他<input>元素（包括不可见的<input>）。
7. 静态页面中的用户名密码框不可见，则需要确保在静态页面中就存在，而不是跳转页面时插入密码表单。

【案例1】：

![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/f5/v3/tRsPrl4PT1yKyf_XsQUhyw/zh-cn_image_0000002540611948.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=FE99924B442D6BE113F7B773C05E4826217560B8A62D163DE8A666F9E210BE6D)

【案例2】：

![](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_scene_100_1/3e/v3/NzlU4ZwUQDewftQt4aJH-Q/zh-cn_image_0000002571171943.png?HW-CC-KV=V1&HW-CC-Date=20260414T041946Z&HW-CC-Expire=86400&HW-CC-Sign=A9A677514B28FE77776C16823548B34A611A27C785B25F995C209DC57D70EFAB)

### 不支持自动填充的密码登录表单类型

1. 初始页面内无用户名密码表单元素，点击登录跳转页面后，新增非<form>类型的用户名密码表单。
2. 密码输入框携带了autocomplete=“new-password”属性。
3. 用户名输入框type="number"，验证码输入框type="number"，无密码输入框。
4. 用户名和密码元素中间存在其他<input>元素，算法推断出的用户名元素，不符合用户预期。
5. 网页通过javascript脚本，变更了<input>元素的焦点或者修改<input>元素的value。
6. 用户名<input>元素上id、name、label内容中匹配到如下密码类型标识：

   收起

   自动换行

   深色代码主题

   复制

   ```
   1. const char* const kNegativeLatin[] = {
   2. "pin",    "parola",   "wagwoord",   "wachtwoord",
   3. "fake",   "parole",   "givenname",  "achinsinsi",
   4. "token",  "parool",   "firstname",  "facalfaire",
   5. "fname",  "lozinka",  "pasahitza",  "focalfaire",
   6. "lname",  "passord",  "pasiwedhi",  "iphasiwedi",
   7. "geslo",  "huahuna",  "passwuert",  "katalaluan",
   8. "heslo",  "fullname", "phasewete",  "adgangskode",
   9. "parol",  "optional", "wachtwurd",  "contrasenya",
   10. "sandi",  "lastname", "cyfrinair",  "contrasinal",
   11. "senha",  "kupuhipa", "katasandi",  "kalmarsirri",
   12. "password", "loluszais",  "tenimiafina",
   13. "second", "passwort", "middlename", "paroladordine",
   14. "codice", "pasvorto", "familyname", "inomboloyokuvula",
   15. "modpas", "salasana", "motdepasse", "numeraeleiloaesesi",
   16. "captcha"};

   18. const char* const kNegativeNonLatin[] = {
   19. "fjalëkalim", "የይለፍቃል", "كلمهالسر", "գաղտնաբառ",
   20. "пароль", "পাসওয়ার্ড", "парола", "密码", "密碼",
   21. "დაგავიწყდათ", "κωδικόςπρόσβασης", "પાસવર્ડ", "סיסמה",
   22. "पासवर्ड", "jelszó", "lykilorð", "paswọọdụ",
   23. "パスワード", "ಪಾಸ್ವರ್ಡ್", "пароль", "ការពាក្យសម្ងាត់",
   24. "암호", "şîfre", "купуясөз", "ລະຫັດຜ່ານ",
   25. "slaptažodis", "лозинка", "पासवर्ड", "нууцүг",
   26. "စကားဝှက်ကို", "पासवर्ड", "رمز", "کلمهعبور",
   27. "hasło", "пароль", "лозинка", "پاسورڊ",
   28. "මුරපදය", "contraseña", "lösenord", "гузарвожа",
   29. "கடவுச்சொல்", "పాస్వర్డ్", "รหัสผ่าน", "пароль",
   30. "پاسورڈ", "mậtkhẩu", "פּאַראָל", "ọrọigbaniwọle"};
   ```
7. 用户名<input>元素的autocomplete="one-time-code"或者"cc-\*"，或者id、name属性上能正则匹配到如下one-time-code或者信用卡标识：

   收起

   自动换行

   深色代码主题

   复制

   ```
   1. inline constexpr char16_t kOneTimePwdRe[] =
   2. u"one.?time|sms.?(code|token|password|pwd|pass)";

   4. inline constexpr char16_t kCardCvcRe[] =
   5. u"verification|card.?identification|security.?code|card.?code"
   6. u"|security.?value"
   7. u"|security.?number|card.?pin|c-v-v"
   8. u"|código de segurança"  // pt-BR
   9. u"|código de seguridad"  // es-MX
   10. u"|karten.?prüfn"        // de-DE
   11. u"|(?:cvn|cvv|cvc|csc|cvd|ccv)"
   12. // We used to match "cid", but it is a substring of "cidade" (Portuguese for
   13. // "city") and needs to be handled carefully.
   14. u"|\\bcid\\b|cccid";
   ```
8. 页面加载完成，<input>的type属性不是"password"，点击登录才变成"password"类型。