Verify phone number
This commit is contained in:
parent
5325159c98
commit
ce7cc41b7c
|
|
@ -379,10 +379,11 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!state.account.accountSmsVerified &&
|
if (!state.account.accountSmsVerified &&
|
||||||
state.isHosted)
|
state.isHosted &&
|
||||||
|
state.company.displayName.isNotEmpty)
|
||||||
if (state.isMenuCollapsed)
|
if (state.isMenuCollapsed)
|
||||||
Tooltip(
|
Tooltip(
|
||||||
message: localization.verifyPhoneHelp,
|
message: localization.verifyPhoneNumberHelp,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsets.only(left: 12),
|
const EdgeInsets.only(left: 12),
|
||||||
|
|
@ -404,7 +405,7 @@ class _MenuDrawerState extends State<MenuDrawer> {
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
tileColor: Colors.orange.shade800,
|
tileColor: Colors.orange.shade800,
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
localization.verifyPhoneHelp,
|
localization.verifyPhoneNumberHelp,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class _UserDetailsState extends State<UserDetails>
|
||||||
|
|
||||||
void _onChanged() {
|
void _onChanged() {
|
||||||
var phone = _phoneController.text.trim();
|
var phone = _phoneController.text.trim();
|
||||||
if (!phone.startsWith('+')) {
|
if (phone.isNotEmpty && !phone.startsWith('+')) {
|
||||||
phone = '+$phone';
|
phone = '+$phone';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,6 +384,38 @@ class _UserDetailsState extends State<UserDetails>
|
||||||
SizedBox(width: kTableColumnGap),
|
SizedBox(width: kTableColumnGap),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
if (!state.account.accountSmsVerified) ...[
|
||||||
|
Expanded(
|
||||||
|
child: OutlinedButton(
|
||||||
|
child: Text(
|
||||||
|
localization.verifyPhoneNumber.toUpperCase(),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
if (state.settingsUIState.isChanged) {
|
||||||
|
showMessageDialog(
|
||||||
|
context: context,
|
||||||
|
message: localization.errorUnsavedChanges);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.user.phone.isEmpty ||
|
||||||
|
user.phone.isEmpty) {
|
||||||
|
showMessageDialog(
|
||||||
|
context: context,
|
||||||
|
message: localization.enterPhoneNumber);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) =>
|
||||||
|
_SmsVerification(state: viewModel.state),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: kTableColumnGap),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
child: OutlinedButton(
|
child: OutlinedButton(
|
||||||
child: Text((state.user.isTwoFactorEnabled
|
child: Text((state.user.isTwoFactorEnabled
|
||||||
|
|
@ -681,3 +713,65 @@ class _EnableTwoFactorState extends State<_EnableTwoFactor> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _SmsVerification extends StatefulWidget {
|
||||||
|
const _SmsVerification({@required this.state});
|
||||||
|
|
||||||
|
final AppState state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<_SmsVerification> createState() => __SmsVerificationState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class __SmsVerificationState extends State<_SmsVerification> {
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
void _sendCode() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
void _verifyCode() {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(localization.verifyPhoneNumber),
|
||||||
|
content: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(localization.codeWasSent),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
DecoratedFormField(
|
||||||
|
label: localization.code,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(
|
||||||
|
localization.cancel.toUpperCase(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => _sendCode(),
|
||||||
|
child: Text(
|
||||||
|
localization.resend.toUpperCase(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => _verifyCode(),
|
||||||
|
child: Text(
|
||||||
|
localization.verify.toUpperCase(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'code_was_sent': 'A code has been sent via SMS',
|
||||||
|
'resend': 'Resend',
|
||||||
|
'verify': 'Verify',
|
||||||
|
'enter_phone_number': 'Please provide a phone number',
|
||||||
'invalid_phone_number': 'Invalid phone number',
|
'invalid_phone_number': 'Invalid phone number',
|
||||||
'verify_phone_help': 'Please verify your phone number to send emails',
|
'verify_phone_number': 'Verify Phone Number',
|
||||||
|
'verify_phone_number_help':
|
||||||
|
'Please verify your phone number to send emails',
|
||||||
'merged_clients': 'Successfully merged clients',
|
'merged_clients': 'Successfully merged clients',
|
||||||
'merge_into': 'Merge Into',
|
'merge_into': 'Merge Into',
|
||||||
'merge': 'Merge',
|
'merge': 'Merge',
|
||||||
|
|
@ -719,8 +725,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
'capture_card': 'Capture Card',
|
'capture_card': 'Capture Card',
|
||||||
'auto_bill_enabled': 'Auto Bill Enabled',
|
'auto_bill_enabled': 'Auto Bill Enabled',
|
||||||
'total_taxes': 'Total Taxes',
|
'total_taxes': 'Total Taxes',
|
||||||
'line_taxes': 'Line Taxes',
|
'line_taxes': 'Line Taxes', 'total_fields': 'Total Fields',
|
||||||
'total_fields': 'Total Fields',
|
|
||||||
'stopped_recurring_invoice': 'Successfully stopped recurring invoice',
|
'stopped_recurring_invoice': 'Successfully stopped recurring invoice',
|
||||||
'started_recurring_invoice': 'Successfully started recurring invoice',
|
'started_recurring_invoice': 'Successfully started recurring invoice',
|
||||||
'resumed_recurring_invoice': 'Successfully resumed recurring invoice',
|
'resumed_recurring_invoice': 'Successfully resumed recurring invoice',
|
||||||
|
|
@ -85205,15 +85210,33 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['merged_clients'] ??
|
_localizedValues[localeCode]['merged_clients'] ??
|
||||||
_localizedValues['en']['merged_clients'];
|
_localizedValues['en']['merged_clients'];
|
||||||
|
|
||||||
String get verifyPhoneHelp =>
|
String get verifyPhoneNumber =>
|
||||||
_localizedValues[localeCode]['verify_phone_help'] ??
|
_localizedValues[localeCode]['verify_phone_number'] ??
|
||||||
_localizedValues['en']['verify_phone_help'];
|
_localizedValues['en']['verify_phone_number'];
|
||||||
|
|
||||||
|
String get verifyPhoneNumberHelp =>
|
||||||
|
_localizedValues[localeCode]['verify_phone_number_help'] ??
|
||||||
|
_localizedValues['en']['verify_phone_number_help'];
|
||||||
|
|
||||||
String get invalidPhoneNumber =>
|
String get invalidPhoneNumber =>
|
||||||
_localizedValues[localeCode]['invalid_phone_number'] ??
|
_localizedValues[localeCode]['invalid_phone_number'] ??
|
||||||
_localizedValues['en']['invalid_phone_number'];
|
_localizedValues['en']['invalid_phone_number'];
|
||||||
|
|
||||||
|
String get enterPhoneNumber =>
|
||||||
|
_localizedValues[localeCode]['enter_phone_number'] ??
|
||||||
|
_localizedValues['en']['enter_phone_number'];
|
||||||
|
|
||||||
|
String get resend =>
|
||||||
|
_localizedValues[localeCode]['resend'] ??
|
||||||
|
_localizedValues['en']['resend'];
|
||||||
|
|
||||||
|
String get verify =>
|
||||||
|
_localizedValues[localeCode]['verify'] ??
|
||||||
|
_localizedValues['en']['verify'];
|
||||||
|
|
||||||
|
String get codeWasSent =>
|
||||||
|
_localizedValues[localeCode]['code_was_sent'] ??
|
||||||
|
_localizedValues['en']['code_was_sent'];
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue