Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/src/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,10 @@ class AppController with ChangeNotifier {
ServerSoftware.piefed => 'username',
ServerSoftware.mbin => throw UnreachableError(),
}: username,
'password': password,
'password': password?.substring(
0,
software == ServerSoftware.lemmy ? 60 : 128,
),
if (software == ServerSoftware.lemmy) 'totp_2fa_token': totp,
}),
);
Expand Down
6 changes: 4 additions & 2 deletions lib/src/screens/settings/login_confirm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class _LoginConfirmScreenState extends State<LoginConfirmScreen> {
padding: const EdgeInsets.all(16),
child: AutofillGroup(
child: Column(
spacing: 12,
children: [
TextEditor(
_usernameEmailTextController,
Expand All @@ -63,13 +64,14 @@ class _LoginConfirmScreenState extends State<LoginConfirmScreen> {
AutofillHints.email,
],
),
const SizedBox(height: 12),
PasswordEditor(
_passwordTextController,
onChanged: (_) => setState(() {}),
maxLength: widget.software == ServerSoftware.lemmy
? 60
: 128,
),
if (widget.software == ServerSoftware.lemmy) ...[
const SizedBox(height: 12),
TextEditor(
_totpTokenTextController,
label: l(context).totpToken,
Expand Down
9 changes: 8 additions & 1 deletion lib/src/widgets/password_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import 'package:flutter/material.dart';
import 'package:interstellar/src/utils/utils.dart';

class PasswordEditor extends StatefulWidget {
const PasswordEditor(this.controller, {this.onChanged, super.key});
const PasswordEditor(
this.controller, {
this.onChanged,
this.maxLength,
super.key,
});

final TextEditingController controller;
final void Function(String)? onChanged;
final int? maxLength;

@override
State<PasswordEditor> createState() => _PasswordEditorState();
Expand Down Expand Up @@ -34,6 +40,7 @@ class _PasswordEditorState extends State<PasswordEditor> {
onChanged: widget.onChanged,
autofillHints: const [AutofillHints.password],
obscureText: obscureText,
maxLength: widget.maxLength,
);
}
}
Loading