Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add password visibility toggle to mobile app login/unlock (#1197)

Leendert de Borstcc846830fe74
diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsx
index e4bb8b29b..8aa6b1efb 100644
--- a/apps/mobile-app/app/login.tsx
+++ b/apps/mobile-app/app/login.tsx
@@ -5,7 +5,7 @@ import { useFocusEffect } from '@react-navigation/native';
import { LinearGradient } from 'expo-linear-gradient';
import { router } from 'expo-router';
import React, { useState, useEffect } from 'react';
-import { StyleSheet, View, Text, SafeAreaView, TextInput, ActivityIndicator, Animated, ScrollView, KeyboardAvoidingView, Platform, Dimensions, Alert } from 'react-native';
+import { StyleSheet, View, Text, SafeAreaView, TextInput, ActivityIndicator, Animated, ScrollView, KeyboardAvoidingView, Platform, Dimensions, Alert, Pressable } from 'react-native';
import { useApiUrl } from '@/utils/ApiUrlUtility';
import ConversionUtility from '@/utils/ConversionUtility';
@@ -64,6 +64,7 @@ export default function LoginScreen() : React.ReactNode {
const [passwordHashString, setPasswordHashString] = useState<string | null>(null);
const [passwordHashBase64, setPasswordHashBase64] = useState<string | null>(null);
const [loginStatus, setLoginStatus] = useState<string | null>(null);
+ const [showPassword, setShowPassword] = useState(false);
const authContext = useAuth();
const dbContext = useDb();
@@ -620,7 +621,7 @@ export default function LoginScreen() : React.ReactNode {
<View style={styles.inputContainer}>
<MaterialIcons
name="person"
- size={24}
+ size={20}
color={colors.textMuted}
style={styles.inputIcon}
/>
@@ -640,7 +641,7 @@ export default function LoginScreen() : React.ReactNode {
<View style={styles.inputContainer}>
<MaterialIcons
name="lock"
- size={24}
+ size={20}
color={colors.textMuted}
style={styles.inputIcon}
/>
@@ -649,13 +650,23 @@ export default function LoginScreen() : React.ReactNode {
value={credentials.password}
onChangeText={(text) => setCredentials({ ...credentials, password: text })}
placeholder={t('auth.passwordPlaceholder')}
- secureTextEntry
+ secureTextEntry={!showPassword}
placeholderTextColor={colors.textMuted}
autoCorrect={false}
autoCapitalize="none"
multiline={false}
numberOfLines={1}
/>
+ <RobustPressable
+ onPress={() => setShowPassword(!showPassword)}
+ style={styles.inputIcon}
+ >
+ <MaterialIcons
+ name={showPassword ? "visibility" : "visibility-off"}
+ size={24}
+ color={colors.textMuted}
+ />
+ </RobustPressable>
</View>
<RobustPressable
style={[styles.button, styles.primaryButton]}
diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsx
index 07f66b0dc..336417670 100644
--- a/apps/mobile-app/app/unlock.tsx
+++ b/apps/mobile-app/app/unlock.tsx
@@ -4,7 +4,7 @@ import { MaterialIcons } from '@expo/vector-icons';
import { LinearGradient } from 'expo-linear-gradient';
import { router } from 'expo-router';
import { useState, useEffect, useCallback } from 'react';
-import { StyleSheet, View, TextInput, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';
+import { StyleSheet, View, TextInput, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text, Pressable } from 'react-native';
import EncryptionUtility from '@/utils/EncryptionUtility';
@@ -34,6 +34,7 @@ export default function UnlockScreen() : React.ReactNode {
const { t } = useTranslation();
const webApi = useWebApi();
const [biometricDisplayName, setBiometricDisplayName] = useState('');
+ const [showPassword, setShowPassword] = useState(false);
/**
* Check if the key derivation parameters are stored in native storage.
@@ -301,7 +302,7 @@ export default function UnlockScreen() : React.ReactNode {
<View style={styles.inputContainer}>
<MaterialIcons
name="lock"
- size={24}
+ size={20}
color={colors.textMuted}
style={styles.inputIcon}
/>
@@ -309,7 +310,7 @@ export default function UnlockScreen() : React.ReactNode {
style={styles.input}
placeholder={t('auth.enterPasswordPlaceholder')}
placeholderTextColor={colors.textMuted}
- secureTextEntry
+ secureTextEntry={!showPassword}
value={password}
onChangeText={setPassword}
autoCapitalize="none"
@@ -317,6 +318,16 @@ export default function UnlockScreen() : React.ReactNode {
multiline={false}
numberOfLines={1}
/>
+ <Pressable
+ onPress={() => setShowPassword(!showPassword)}
+ style={styles.inputIcon}
+ >
+ <MaterialIcons
+ name={showPassword ? "visibility" : "visibility-off"}
+ size={20}
+ color={colors.textMuted}
+ />
+ </Pressable>
</View>
<RobustPressable