feat: add dedicated create-user and create-account admin flows

This commit is contained in:
xuhongbin
2026-03-09 19:06:02 +08:00
parent 58393a6730
commit 293b62b444
13 changed files with 1576 additions and 57 deletions

View File

@@ -109,6 +109,7 @@ export default function SettingsScreen() {
const [connectionState, setConnectionState] = useState<ConnectionState>('idle');
const [connectionMessage, setConnectionMessage] = useState('');
const [isRefreshing, setIsRefreshing] = useState(false);
const [showAdminKey, setShowAdminKey] = useState(false);
const { control, handleSubmit, formState, reset } = useForm<FormValues>({
resolver: zodResolver(schema),
defaultValues: {
@@ -227,15 +228,32 @@ export default function SettingsScreen() {
control={control}
name="adminApiKey"
render={({ field: { onChange, value } }) => (
<TextInput
value={value}
onChangeText={onChange}
placeholder="admin-xxxxxxxx"
placeholderTextColor="#9b9081"
autoCapitalize="none"
autoCorrect={false}
style={{ backgroundColor: colors.mutedCard, borderRadius: 16, paddingHorizontal: 16, paddingVertical: 14, fontSize: 16, color: colors.text }}
/>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
<TextInput
value={value}
onChangeText={onChange}
placeholder="admin-xxxxxxxx"
placeholderTextColor="#9b9081"
autoCapitalize="none"
autoCorrect={false}
secureTextEntry={!showAdminKey}
style={{
flex: 1,
backgroundColor: colors.mutedCard,
borderRadius: 16,
paddingHorizontal: 16,
paddingVertical: 14,
fontSize: 16,
color: colors.text,
}}
/>
<Pressable
onPress={() => setShowAdminKey((value) => !value)}
style={{ backgroundColor: colors.border, borderRadius: 12, paddingHorizontal: 12, paddingVertical: 10 }}
>
<Text style={{ fontSize: 12, fontWeight: '700', color: '#4e463e' }}>{showAdminKey ? '隐藏' : '显示'}</Text>
</Pressable>
</View>
)}
/>
</View>