Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Responsive tweaks (#771)
Leendert de Borst7238792895fe
diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsxindex e8abbe0fd..cc7d5bc15 100644--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx@@ -6,6 +6,7 @@ import Toast from 'react-native-toast-message';import { Resolver, useForm } from 'react-hook-form';import { yupResolver } from '@hookform/resolvers/yup';import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';+import * as Haptics from 'expo-haptics';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';@@ -186,6 +187,19 @@ export default function AddEditCredentialScreen() : React.ReactNode {}}, [isEditMode, watch, setValue, setIsPasswordVisible, initializeGenerators, dbContext.sqliteClient]);+ /**+ * Handle the generate random alias button press.+ */+ const handleGenerateRandomAlias = useCallback(async (): Promise<void> => {+ // Trigger haptic feedback when pull-to-refresh is activated+ if (Platform.OS === 'ios') {+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);+ } else if (Platform.OS === 'android') {+ Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);+ }+ await generateRandomAlias();+ }, [generateRandomAlias]);+/*** Submit the form for either creating or updating a credential.* @param {Credential} data - The form data.@@ -611,7 +625,7 @@ export default function AddEditCredentialScreen() : React.ReactNode {}]}/>- <TouchableOpacity style={styles.generateButton} onPress={generateRandomAlias}>+ <TouchableOpacity style={styles.generateButton} onPress={handleGenerateRandomAlias}><MaterialIcons name="auto-fix-high" size={20} color="#fff" /><ThemedText style={styles.generateButtonText}>Generate Random Alias</ThemedText></TouchableOpacity>diff --git a/apps/mobile-app/app/(tabs)/credentials/index.tsx b/apps/mobile-app/app/(tabs)/credentials/index.tsxindex 539ba4806..78cefc817 100644--- a/apps/mobile-app/app/(tabs)/credentials/index.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/index.tsx@@ -230,6 +230,7 @@ export default function CredentialsScreen() : React.ReactNode {color: colors.textMuted,fontSize: 16,marginTop: 24,+ opacity: 0.7,textAlign: 'center',},searchContainer: {@@ -333,7 +334,7 @@ export default function CredentialsScreen() : React.ReactNode {ListEmptyComponent={!isLoadingCredentials ? (<Text style={styles.emptyText}>- {searchQuery ? 'No matching credentials found' : 'No credentials found'}+ {searchQuery ? 'No matching credentials found' : 'No credentials found. Create one to get started. Tip: you can also login to the AliasVault web app to import credentials from other password managers.'}</Text>) : null}diff --git a/apps/mobile-app/app/(tabs)/emails/index.tsx b/apps/mobile-app/app/(tabs)/emails/index.tsxindex 4a8f443c5..23bd3b64b 100644--- a/apps/mobile-app/app/(tabs)/emails/index.tsx+++ b/apps/mobile-app/app/(tabs)/emails/index.tsx@@ -163,7 +163,7 @@ export default function EmailsScreen() : React.ReactNode {},contentContainer: {paddingBottom: 40,- paddingTop: 26,+ paddingTop: 42,},emptyText: {color: colors.textMuted,diff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsxindex acbaa92ae..45fc65b32 100644--- a/apps/mobile-app/app/(tabs)/settings/index.tsx+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx@@ -125,7 +125,7 @@ export default function SettingsScreen() : React.ReactNode {},scrollContent: {paddingBottom: 40,- paddingTop: 26,+ paddingTop: 42,},scrollView: {flex: 1,diff --git a/apps/mobile-app/app/_layout.tsx b/apps/mobile-app/app/_layout.tsxindex c11b8e421..3d74250a2 100644--- a/apps/mobile-app/app/_layout.tsx+++ b/apps/mobile-app/app/_layout.tsx@@ -152,7 +152,7 @@ function RootLayoutNav() : React.ReactNode {* Handle error during vault sync.*/onError: () => {- // Navigate to the manual unlock screen.+ // Logout user and navigate to the login screen.setRedirectTarget('/unlock');setBootComplete(true);}diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsxindex 063c14148..f9e8d83b4 100644--- a/apps/mobile-app/app/login.tsx+++ b/apps/mobile-app/app/login.tsx@@ -127,6 +127,9 @@ export default function LoginScreen() : React.ReactNode {await dbContext.initializeDatabase(vaultResponseJson);await authContext.login();+ // Update offline mode to false as we have successfully logged in.+ authContext.setOfflineMode(false);+setTwoFactorRequired(false);setTwoFactorCode('');setPasswordHashString(null);@@ -306,7 +309,7 @@ export default function LoginScreen() : React.ReactNode {gap: 8,},buttonText: {- color: colors.text,+ color: colors.primarySurfaceText,fontSize: 16,fontWeight: '600',},@@ -527,7 +530,7 @@ export default function LoginScreen() : React.ReactNode {setTwoFactorCode('');setPasswordHashString(null);setPasswordHashBase64(null);- setLoginResponse(null);+ setInitiateLoginResponse(null);setError(null);}}>diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsxindex 1ab9dc692..767ddcb06 100644--- a/apps/mobile-app/app/unlock.tsx+++ b/apps/mobile-app/app/unlock.tsx@@ -1,7 +1,8 @@import { useState, useEffect, useCallback } from 'react';-import { StyleSheet, View, TextInput, TouchableOpacity, Alert, Image, KeyboardAvoidingView, Platform } from 'react-native';+import { StyleSheet, View, TextInput, TouchableOpacity, Alert, Image, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text } from 'react-native';import { router } from 'expo-router';import { MaterialIcons } from '@expo/vector-icons';+import { LinearGradient } from 'expo-linear-gradient';import { useAuth } from '@/context/AuthContext';import { useDb } from '@/context/DbContext';@@ -12,8 +13,8 @@ import { useColors } from '@/hooks/useColorScheme';import EncryptionUtility from '@/utils/EncryptionUtility';import { useWebApi } from '@/context/WebApiContext';import avatarImage from '@/assets/images/avatar.webp';-import { TitleContainer } from '@/components/ui/TitleContainer';import NativeVaultManager from '@/specs/NativeVaultManager';+import Logo from '@/assets/images/logo.svg';/*** Unlock screen.@@ -26,6 +27,8 @@ export default function UnlockScreen() : React.ReactNode {const [isFaceIDAvailable, setIsFaceIDAvailable] = useState(false);const colors = useColors();const webApi = useWebApi();+ const { getBiometricDisplayName } = useAuth();+ const [biometricDisplayName, setBiometricDisplayName] = useState('');/*** Check if the key derivation parameters are stored in native storage.@@ -45,14 +48,18 @@ export default function UnlockScreen() : React.ReactNode {getKeyDerivationParams();/**- * Check the face ID status.+ * Fetch the biometric config.*/- const checkFaceIDStatus = async () : Promise<void> => {+ const fetchBiometricConfig = async () : Promise<void> => {const enabled = await isFaceIDEnabled();setIsFaceIDAvailable(enabled);++ const displayName = await getBiometricDisplayName();+ setBiometricDisplayName(displayName);};- checkFaceIDStatus();- }, [isFaceIDEnabled, getKeyDerivationParams]);+ fetchBiometricConfig();++ }, [isFaceIDEnabled, getKeyDerivationParams, getBiometricDisplayName]);/*** Handle the unlock.@@ -124,6 +131,12 @@ export default function UnlockScreen() : React.ReactNode {};const styles = StyleSheet.create({+ appName: {+ color: colors.text,+ fontSize: 32,+ fontWeight: 'bold',+ textAlign: 'center',+ },avatar: {borderRadius: 20,height: 40,@@ -170,12 +183,21 @@ export default function UnlockScreen() : React.ReactNode {fontSize: 16,fontWeight: '600',},- headerContainer: {- alignItems: 'center',- justifyContent: 'center',+ gradientContainer: {+ height: Dimensions.get('window').height * 0.4,+ left: 0,+ position: 'absolute',+ right: 0,+ top: 0,+ },+ headerSection: {+ paddingBottom: 24,+ paddingHorizontal: 16,+ paddingTop: 24,},input: {backgroundColor: colors.background,+ borderRadius: 8,color: colors.text,flex: 1,fontSize: 16,@@ -190,32 +212,39 @@ export default function UnlockScreen() : React.ReactNode {borderWidth: 1,flexDirection: 'row',marginBottom: 16,- width: '100%',},inputIcon: {padding: 12,},keyboardAvoidingView: {- alignItems: 'center',flex: 1,- justifyContent: 'center',- padding: 20,},loadingContainer: {alignItems: 'center',flex: 1,justifyContent: 'center',},- logoutButton: {+ logoContainer: {alignItems: 'center',- height: 50,+ marginBottom: 8,+ },+ logoutButton: {+ alignSelf: 'center',justifyContent: 'center',- width: '100%',+ marginTop: 16,},logoutButtonText: {color: colors.red,fontSize: 16,},+ mainContent: {+ flex: 1,+ justifyContent: 'center',+ paddingHorizontal: 20,+ },+ scrollContent: {+ flexGrow: 1,+ },subtitle: {color: colors.text,fontSize: 16,@@ -242,65 +271,81 @@ export default function UnlockScreen() : React.ReactNode {behavior={Platform.OS === 'ios' ? 'padding' : 'height'}style={styles.keyboardAvoidingView}>- <View style={styles.headerContainer}>- <TitleContainer title="Unlock Vault" />- </View>-- <View style={styles.content}>- <View style={styles.avatarContainer}>- <Image- source={avatarImage}- style={styles.avatar}+ <TouchableWithoutFeedback onPress={Keyboard.dismiss}>+ <ScrollView+ contentContainerStyle={styles.scrollContent}+ keyboardShouldPersistTaps="handled"+ >+ <LinearGradient+ colors={[colors.loginHeader, colors.background]}+ style={styles.gradientContainer}/>- <ThemedText style={styles.username}>{username}</ThemedText>- </View>- <ThemedText style={styles.subtitle}>Enter your password to unlock your vault</ThemedText>- <View style={styles.inputContainer}>- <MaterialIcons- name="lock"- size={24}- color={colors.textMuted}- style={styles.inputIcon}- />- <TextInput- style={styles.input}- placeholder="Password"- placeholderTextColor={colors.textMuted}- secureTextEntry- value={password}- onChangeText={setPassword}- autoCapitalize="none"- autoCorrect={false}- />- </View>+ <View style={styles.mainContent}>+ <View style={styles.headerSection}>+ <View style={styles.logoContainer}>+ <Logo width={80} height={80} />+ <Text style={styles.appName}>Unlock Vault</Text>+ </View>+ </View>+ <View style={styles.content}>+ <View style={styles.avatarContainer}>+ <Image+ source={avatarImage}+ style={styles.avatar}+ />+ <ThemedText style={styles.username}>{username}</ThemedText>+ </View>+ <ThemedText style={styles.subtitle}>Enter your password to unlock your vault</ThemedText>- <TouchableOpacity- style={styles.button}- onPress={handleUnlock}- disabled={isLoading}- >- <ThemedText style={styles.buttonText}>- {isLoading ? 'Unlocking...' : 'Unlock'}- </ThemedText>- </TouchableOpacity>+ <View style={styles.inputContainer}>+ <MaterialIcons+ name="lock"+ size={24}+ color={colors.textMuted}+ style={styles.inputIcon}+ />+ <TextInput+ style={styles.input}+ placeholder="Password"+ placeholderTextColor={colors.textMuted}+ secureTextEntry+ value={password}+ onChangeText={setPassword}+ autoCapitalize="none"+ autoCorrect={false}+ />+ </View>++ <TouchableOpacity+ style={styles.button}+ onPress={handleUnlock}+ disabled={isLoading}+ >+ <ThemedText style={styles.buttonText}>+ {isLoading ? 'Unlocking...' : 'Unlock'}+ </ThemedText>+ </TouchableOpacity>- {isFaceIDAvailable && (- <TouchableOpacity- style={styles.faceIdButton}- onPress={handleFaceIDRetry}- >- <ThemedText style={styles.faceIdButtonText}>Try Face ID Again</ThemedText>- </TouchableOpacity>- )}- </View>+ {isFaceIDAvailable && (+ <TouchableOpacity+ style={styles.faceIdButton}+ onPress={handleFaceIDRetry}+ >+ <ThemedText style={styles.faceIdButtonText}>Try {biometricDisplayName} Again</ThemedText>+ </TouchableOpacity>+ )}+ </View>- <TouchableOpacity- style={styles.logoutButton}- onPress={handleLogout}- >- <ThemedText style={styles.logoutButtonText}>Logout</ThemedText>- </TouchableOpacity>+ <TouchableOpacity+ style={styles.logoutButton}+ onPress={handleLogout}+ >+ <ThemedText style={styles.logoutButtonText}>Logout</ThemedText>+ </TouchableOpacity>+ </View>+ </ScrollView>+ </TouchableWithoutFeedback></KeyboardAvoidingView>)}</ThemedView>diff --git a/apps/mobile-app/components/themed/ThemedScrollView.tsx b/apps/mobile-app/components/themed/ThemedScrollView.tsxindex 334bfa10f..7eebf2a66 100644--- a/apps/mobile-app/components/themed/ThemedScrollView.tsx+++ b/apps/mobile-app/components/themed/ThemedScrollView.tsx@@ -17,7 +17,7 @@ export function ThemedScrollView({ style, lightColor, darkColor, ...otherProps }const insets = useSafeAreaInsets();const paddingTop = Platform.OS === 'ios' ? insets.top + 36 : 64;- const paddingBottom = Platform.OS === 'ios' ? insets.bottom : 0;+ const paddingBottom = Platform.OS === 'ios' ? insets.bottom + 60 : 0;return (<ScrollView@@ -29,12 +29,8 @@ export function ThemedScrollView({ style, lightColor, darkColor, ...otherProps });}-const HEADER_HEIGHT = Platform.OS === 'ios' ? 96 : 56;-const styles = StyleSheet.create({container: {flex: 1,- marginBottom: 80,- paddingTop: HEADER_HEIGHT,},});\ No newline at end of filediff --git a/apps/mobile-app/components/ui/TitleContainer.tsx b/apps/mobile-app/components/ui/TitleContainer.tsxindex e07984240..91f01777f 100644--- a/apps/mobile-app/components/ui/TitleContainer.tsx+++ b/apps/mobile-app/components/ui/TitleContainer.tsx@@ -1,7 +1,6 @@import { StyleSheet, View } from 'react-native';-import { OfflineBanner } from '../OfflineBanner';-+import { OfflineBanner } from '@/components/OfflineBanner';import { ThemedText } from '@/components/themed/ThemedText';import Logo from '@/assets/images/logo.svg';diff --git a/apps/mobile-app/utils/WebApiService.ts b/apps/mobile-app/utils/WebApiService.tsindex 531048fd4..b6694a4e4 100644--- a/apps/mobile-app/utils/WebApiService.ts+++ b/apps/mobile-app/utils/WebApiService.ts@@ -249,7 +249,16 @@ export class WebApiService {public async getStatus(): Promise<StatusResponse> {try {return await this.get<StatusResponse>('Auth/status');- } catch {+ } catch (error) {+ if (error instanceof Error && error.message.includes('Session expired')) {+ /**+ * If session expired, logout the user immediately as otherwise this would+ * trigger a server offline banner.+ */+ this.authContextLogout(error.message);+ throw error;+ }+/*** If the status endpoint is not available, return a default status response which will trigger* a logout and error message.