This commit is contained in:
Hillel Coren 2021-02-25 17:43:28 +02:00
parent aa4c5e6593
commit a3bf0c2521
2 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import 'package:invoiceninja_flutter/ui/app/forms/password_field.dart';
import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart';
import 'package:invoiceninja_flutter/ui/settings/user_details_vm.dart';
import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/utils/dialogs.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:url_launcher/url_launcher.dart';
@ -108,7 +109,7 @@ class _UserDetailsState extends State<UserDetails>
..firstName = _firstNameController.text.trim()
..lastName = _lastNameController.text.trim()
..email = _emailController.text.trim()
..firstName = _firstNameController.text.trim()
..phone = _phoneController.text.trim()
..password = _passwordController.text.trim());
if (user != widget.viewModel.user) {
widget.viewModel.onChanged(user);
@ -215,6 +216,14 @@ class _UserDetailsState extends State<UserDetails>
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)),
onPressed: () {
if (state.user.phone.isEmpty || user.phone.isEmpty) {
showMessageDialog(
context: context,
message:
localization.enterPhoneToEnableTwoFactor);
return;
}
showDialog<void>(
context: context,
builder: (BuildContext context) =>
@ -310,6 +319,7 @@ class _EnableTwoFactorState extends State<_EnableTwoFactor> {
},
),
),
SizedBox(width: kTableColumnGap),
SizedBox(
width: 100,
child: TextButton(
@ -332,6 +342,7 @@ class _EnableTwoFactorState extends State<_EnableTwoFactor> {
},
),
),
SizedBox(width: kTableColumnGap),
SizedBox(
width: 100,
child: TextButton(

View File

@ -15,6 +15,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'enter_phone_to_enable_two_factor':
'Please provide a mobile phone number to enable two factor authentication',
'send_sms': 'Send SMS',
'sms_code': 'SMS Code',
'two_factor_setup_help': 'Scan the bar code with a :link compatible app.',
@ -54493,6 +54495,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get sendSms => _localizedValues[localeCode]['send_sms'] ?? '';
String get enterPhoneToEnableTwoFactor => _localizedValues[localeCode]['enter_phone_to_enable_two_factor'] ?? '';
String lookup(String key) {
final lookupKey = toSnakeCase(key);