Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions lib/shared/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const String updateCheckerEndpoint = 'https://komodo.earth/adexwebversion';
final Uri feedbackUrl = Uri.parse('https://komodo.earth:8181/webform/');
const int feedbackMaxLength = 1000;
const int contactDetailsMaxLength = 100;
// Maximum allowed length for passwords across the app
// TODO: Mirror this limit in the SDK validation and any backend API constraints
const int passwordMaxLength = 128;
final RegExp discordUsernameRegex = RegExp(r'^[a-zA-Z0-9._]{2,32}$');
final RegExp telegramUsernameRegex = RegExp(r'^[a-zA-Z0-9_]{5,32}$');
final RegExp matrixIdRegex = RegExp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:komodo_ui_kit/komodo_ui_kit.dart';
import 'package:web_dex/shared/constants.dart';

class TrezorDialogSelectWallet extends StatelessWidget {
const TrezorDialogSelectWallet({Key? key, required this.onComplete})
Expand Down Expand Up @@ -100,6 +101,8 @@ class _TrezorHiddenWalletState extends State<_TrezorHiddenWallet> {
keyboardType: TextInputType.text,
autofillHints: const [AutofillHints.password],
obscureText: true,
maxLength: passwordMaxLength,
counterText: '',
focusNode: _passphraseFieldFocusNode,
onFieldSubmitted: (_) => _onSubmit(),
validator: (String? text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:web_dex/bloc/auth_bloc/auth_bloc.dart';
import 'package:web_dex/common/screen.dart';
import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/model/wallet.dart';
import 'package:web_dex/shared/constants.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';

// TODO: refactor this widget, and other seed viewing/backup related widgets
Expand Down Expand Up @@ -74,7 +75,8 @@ class _PasswordDialogContentState extends State<PasswordDialogContent> {
autofocus: true,
autocorrect: false,
obscureText: _isObscured,
inputFormatters: [LengthLimitingTextInputFormatter(40)],
maxLength: passwordMaxLength,
counterText: '',
errorMaxLines: 6,
errorText: _error,
hintText: LocaleKeys.enterThePassword.tr(),
Expand Down Expand Up @@ -276,7 +278,8 @@ class _PasswordDialogContentWithLoadingState
autofocus: true,
autocorrect: false,
obscureText: _isObscured,
inputFormatters: [LengthLimitingTextInputFormatter(40)],
maxLength: passwordMaxLength,
counterText: '',
errorMaxLines: 6,
errorText: _error,
hintText: LocaleKeys.enterThePassword.tr(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/model/wallet.dart';
import 'package:web_dex/shared/utils/validators.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';
import 'package:web_dex/shared/constants.dart';
import 'package:web_dex/views/common/page_header/page_header.dart';

class PasswordUpdatePage extends StatefulWidget {
Expand Down Expand Up @@ -369,8 +370,9 @@ class _PasswordField extends StatelessWidget {
autocorrect: false,
enableInteractiveSelection: true,
obscureText: isObscured,
maxLength: passwordMaxLength,
counterText: '',
autofillHints: autofillHints,
inputFormatters: [LengthLimitingTextInputFormatter(40)],
validator: validator,
errorMaxLines: 6,
hintText: hintText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/shared/utils/validators.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';
import 'package:komodo_ui_kit/komodo_ui_kit.dart';
import 'package:web_dex/shared/constants.dart';

class CreationPasswordFields extends StatefulWidget {
const CreationPasswordFields({
Expand Down Expand Up @@ -62,9 +63,10 @@ class _CreationPasswordFieldsState extends State<CreationPasswordFields> {
obscureText: _isObscured,
enableInteractiveSelection: true,
validationMode: InputValidationMode.eager,
inputFormatters: [LengthLimitingTextInputFormatter(40)],
validator: _validateConfirmPasswordField,
onFieldSubmitted: widget.onFieldSubmitted,
maxLength: passwordMaxLength,
Comment thread
CharlVS marked this conversation as resolved.
Outdated
counterText: '',
errorMaxLines: 6,
autofillHints: const [AutofillHints.newPassword],
hintText: LocaleKeys.walletCreationConfirmPasswordHint.tr(),
Expand All @@ -79,8 +81,9 @@ class _CreationPasswordFieldsState extends State<CreationPasswordFields> {
autocorrect: false,
enableInteractiveSelection: true,
obscureText: _isObscured,
inputFormatters: [LengthLimitingTextInputFormatter(40)],
validator: _validatePasswordField,
maxLength: passwordMaxLength,
Comment thread
CharlVS marked this conversation as resolved.
counterText: '',
errorMaxLines: 6,
autofillHints: const [AutofillHints.newPassword],
hintText: LocaleKeys.walletCreationPasswordHint.tr(),
Expand Down
3 changes: 3 additions & 0 deletions lib/views/wallets_manager/widgets/wallet_deleting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:web_dex/blocs/wallets_repository.dart';
import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/model/wallet.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';
import 'package:web_dex/shared/constants.dart';

class WalletDeleting extends StatefulWidget {
const WalletDeleting({
Expand Down Expand Up @@ -218,6 +219,8 @@ class _PasswordFieldState extends State<_PasswordField> {
autofocus: true,
autocorrect: false,
obscureText: _isObscured,
maxLength: passwordMaxLength,
counterText: '',
errorText: widget.errorText,
validator: widget.validator,
validationMode: InputValidationMode.eager,
Expand Down
3 changes: 3 additions & 0 deletions lib/views/wallets_manager/widgets/wallet_import_by_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:web_dex/shared/utils/encryption_tool.dart';
import 'package:web_dex/shared/widgets/disclaimer/eula_tos_checkboxes.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';
import 'package:web_dex/shared/widgets/quick_login_switch.dart';
import 'package:web_dex/shared/constants.dart';
import 'package:web_dex/views/wallets_manager/widgets/custom_seed_checkbox.dart';
import 'package:web_dex/views/wallets_manager/widgets/hdwallet_mode_switch.dart';

Expand Down Expand Up @@ -121,6 +122,8 @@ class _WalletImportByFileState extends State<WalletImportByFile> {
autocorrect: false,
enableInteractiveSelection: true,
obscureText: _isObscured,
maxLength: passwordMaxLength,
counterText: '',
autofillHints: const [AutofillHints.password],
validator: (_) {
return _filePasswordError;
Expand Down
3 changes: 3 additions & 0 deletions lib/views/wallets_manager/widgets/wallet_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/model/wallet.dart';
import 'package:web_dex/shared/widgets/password_visibility_control.dart';
import 'package:web_dex/shared/widgets/quick_login_switch.dart';
import 'package:web_dex/shared/constants.dart';
import 'package:web_dex/views/wallets_manager/widgets/hdwallet_mode_switch.dart';

class WalletLogIn extends StatefulWidget {
Expand Down Expand Up @@ -304,6 +305,8 @@ class _PasswordTextFieldState extends State<PasswordTextField> {
autocorrect: false,
controller: widget.controller,
obscureText: _isPasswordObscured,
maxLength: passwordMaxLength,
counterText: '',
errorText: widget.errorText,
autofillHints: widget.autofillHints ?? const [AutofillHints.password],
hintText: LocaleKeys.walletCreationPasswordHint.tr(),
Expand Down
Loading