[PR #1832] Fix save password #1714

Open
opened 2026-04-25 00:00:47 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1832
Author: @ckbaker10
Created: 3/28/2026
Status: 🔄 Open

Base: masterHead: fix-save-password


📝 Commits (7)

📊 Changes

10 files changed (+172 additions, -50 deletions)

View changed files

📝 android/app/build.gradle (+5 -0)
android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java (+0 -26)
📝 android/app/src/main/assets/capacitor.config.json (+1 -1)
📝 android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt (+6 -0)
android/app/src/main/java/com/audiobookshelf/app/plugins/AbsCredentialManager.kt (+106 -0)
android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java (+0 -18)
📝 capacitor.config.json (+1 -1)
📝 components/connection/ServerConnectForm.vue (+19 -2)
📝 components/ui/TextInput.vue (+14 -2)
plugins/capacitor/AbsCredentialManager.js (+20 -0)

📄 Description

Brief summary

Adds Android Credential Manager integration so the app can save and retrieve login credentials via the system password manager (e.g., Google Password Manager), and enables proper autocomplete attributes on the login form inputs for better autofill support.

Pull Request Type

  • Platform: Android only (iOS unchanged)
  • Scope: Frontend + Android native plugin

In-depth Description

Currently the app has autocomplete="off" hardcoded on all text inputs, and there is no integration with the Android Credential Manager API. This means users cannot save or autofill their server login credentials using their device's password manager.

This PR adds:

  1. AbsCredentialManager native plugin (Kotlin) — A Capacitor plugin that wraps Android's androidx.credentials API with two methods:

    • saveCredential({ username, password }) — Saves credentials via CreatePasswordRequest. Called after a successful password login so the system prompts the user to save.
    • getCredential() — Retrieves saved credentials via GetPasswordOption. Called when the auth form is shown to pre-fill username/password if available.
    • Errors are handled gracefully (e.g., no credential provider configured, no saved credentials) — they log warnings but don't block the login flow.
  2. AbsCredentialManager JS bridge — Capacitor plugin registration with a web fallback (no-op on web).

  3. TextInput.vue changes — The component now accepts autocomplete, name, and inputId props instead of hardcoding autocomplete="off", enabling proper HTML autofill semantics.

  4. ServerConnectForm.vue changes — The username and password fields now have autocomplete="username" / autocomplete="current-password" and proper name/id attributes. After successful login, saveCredential is called. When the auth form appears, getCredential is called to pre-fill saved credentials.

  5. MainActivity.kt — Registers the new plugin and sets importantForAutofill = YES on the WebView for Android O+.

  6. build.gradle — Adds androidx.credentials, credentials-play-services-auth, and lifecycle-runtime-ktx dependencies.

The save will fail gracefully with a warning if the device has no credential provider configured (e.g., CreateCredentialNoCreateOptionException: No create options available). This does not affect the login flow.

How have you tested this?

  1. Clean install (cleared app data), entered server address, username, and password
  2. Verified AbsCredentialManager.saveCredential is called after successful login (visible in logcat as pluginId: AbsCredentialManager, methodName: saveCredential)
  3. Verified the error is caught gracefully when no credential provider is configured on the device
  4. Verified the login flow completes successfully regardless of credential manager success/failure
  5. Verified AbsCredentialManager.getCredential is called when the auth form is displayed after entering a server address

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1832 **Author:** [@ckbaker10](https://github.com/ckbaker10) **Created:** 3/28/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix-save-password` --- ### 📝 Commits (7) - [`b6e8967`](https://github.com/advplyr/audiobookshelf-app/commit/b6e8967472b84359becfc35e4d94541cb5a752ec) Enable autofill - [`889fdb3`](https://github.com/advplyr/audiobookshelf-app/commit/889fdb31708ddbfd0a1d7ba27d921c02a944b3ca) Autofill fix - [`875fd34`](https://github.com/advplyr/audiobookshelf-app/commit/875fd34f6fab5cd201af93a382df71c573776e90) Autofill fix - [`f0d61c5`](https://github.com/advplyr/audiobookshelf-app/commit/f0d61c5518b215f1085ddfdfdf4249454c06e471) Autofill fix - [`8371049`](https://github.com/advplyr/audiobookshelf-app/commit/837104972cded64c3819e6d533701545d5c8f057) Autofill fix - [`a347788`](https://github.com/advplyr/audiobookshelf-app/commit/a3477888903fbc199ce6cfe8f76bd54498b38cf0) Autofill fix - [`d7ac21f`](https://github.com/advplyr/audiobookshelf-app/commit/d7ac21f3c57d73c6a75d76cb54100c426c2f50dd) Autofill fix ### 📊 Changes **10 files changed** (+172 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `android/app/build.gradle` (+5 -0) ➖ `android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java` (+0 -26) 📝 `android/app/src/main/assets/capacitor.config.json` (+1 -1) 📝 `android/app/src/main/java/com/audiobookshelf/app/MainActivity.kt` (+6 -0) ➕ `android/app/src/main/java/com/audiobookshelf/app/plugins/AbsCredentialManager.kt` (+106 -0) ➖ `android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java` (+0 -18) 📝 `capacitor.config.json` (+1 -1) 📝 `components/connection/ServerConnectForm.vue` (+19 -2) 📝 `components/ui/TextInput.vue` (+14 -2) ➕ `plugins/capacitor/AbsCredentialManager.js` (+20 -0) </details> ### 📄 Description ## Brief summary Adds Android Credential Manager integration so the app can save and retrieve login credentials via the system password manager (e.g., Google Password Manager), and enables proper `autocomplete` attributes on the login form inputs for better autofill support. ## Pull Request Type - **Platform:** Android only (iOS unchanged) - **Scope:** Frontend + Android native plugin ## In-depth Description Currently the app has `autocomplete="off"` hardcoded on all text inputs, and there is no integration with the Android Credential Manager API. This means users cannot save or autofill their server login credentials using their device's password manager. This PR adds: 1. **`AbsCredentialManager` native plugin** (Kotlin) — A Capacitor plugin that wraps Android's `androidx.credentials` API with two methods: - `saveCredential({ username, password })` — Saves credentials via `CreatePasswordRequest`. Called after a successful password login so the system prompts the user to save. - `getCredential()` — Retrieves saved credentials via `GetPasswordOption`. Called when the auth form is shown to pre-fill username/password if available. - Errors are handled gracefully (e.g., no credential provider configured, no saved credentials) — they log warnings but don't block the login flow. 2. **`AbsCredentialManager` JS bridge** — Capacitor plugin registration with a web fallback (no-op on web). 3. **`TextInput.vue` changes** — The component now accepts `autocomplete`, `name`, and `inputId` props instead of hardcoding `autocomplete="off"`, enabling proper HTML autofill semantics. 4. **`ServerConnectForm.vue` changes** — The username and password fields now have `autocomplete="username"` / `autocomplete="current-password"` and proper `name`/`id` attributes. After successful login, `saveCredential` is called. When the auth form appears, `getCredential` is called to pre-fill saved credentials. 5. **`MainActivity.kt`** — Registers the new plugin and sets `importantForAutofill = YES` on the WebView for Android O+. 6. **`build.gradle`** — Adds `androidx.credentials`, `credentials-play-services-auth`, and `lifecycle-runtime-ktx` dependencies. The save will fail gracefully with a warning if the device has no credential provider configured (e.g., `CreateCredentialNoCreateOptionException: No create options available`). This does not affect the login flow. ## How have you tested this? 1. Clean install (cleared app data), entered server address, username, and password 2. Verified `AbsCredentialManager.saveCredential` is called after successful login (visible in logcat as `pluginId: AbsCredentialManager, methodName: saveCredential`) 3. Verified the error is caught gracefully when no credential provider is configured on the device 4. Verified the login flow completes successfully regardless of credential manager success/failure 5. Verified `AbsCredentialManager.getCredential` is called when the auth form is displayed after entering a server address --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:47 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1714