Add option to require server login for user profile (#1367)

## Description
This PR adds a new method of protecting a user profile when switching to
it: server login. When enabled, switching to the user requires
authenticating with the server again via Quick Connect or username &
password. This is basically the same as the official client.

### Related issues
Closes #321
Related to #1330 - might cause merge conflicts
Related to #1287 - definitely causes merge conflicts

### Testing
Emulator with various uses cases including auto sign-in, switching
between server login & PIN protection, and removing the protection

## Screenshots
N/A, the login looks identical as adding a new user

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-05-20 12:00:02 -04:00 committed by GitHub
parent 1463480e26
commit 45d466d76f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 813 additions and 35 deletions

View file

@ -434,8 +434,11 @@ class MainActivityViewModel
appUpgradeHandler.copySubfont(false)
val prefs =
preferences.data.firstOrNull() ?: AppPreferences.getDefaultInstance()
val userHasPin = serverRepository.currentUser.value?.hasPin == true
if (prefs.signInAutomatically && !userHasPin) {
val allowAutoSignIn =
serverRepository.currentUser.value?.let {
!it.hasPin && !it.requireLogin
} == true
if (prefs.signInAutomatically && allowAutoSignIn) {
val current =
serverRepository.restoreSession(
prefs.currentServerId?.toUUIDOrNull(),