diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 000000000..48ec89c60 Binary files /dev/null and b/assets/images/logo.png differ diff --git a/lib/constants.dart b/lib/constants.dart index d23e7d014..0298c73ca 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -137,7 +137,6 @@ const int kMillisecondsToRefreshData = 1000 * 60 * 15; // 15 minutes const int kUpdatedAtBufferSeconds = 600; const int kMillisecondsToRefreshActivities = 1000 * 60 * 60 * 24; // 1 day const int kMillisecondsToRefreshStaticData = 1000 * 60 * 60 * 24; // 1 day -const int kMillisecondsToReenterPassword = 1000 * 60 * 30; // 30 minutes const int kMillisecondsToDebounceUpdate = 500; // .5 second const int kMillisecondsToDebounceSave = 1500; // 1.5 seconds diff --git a/lib/data/web_client.dart b/lib/data/web_client.dart index 09857f4f6..b6e26a4ce 100644 --- a/lib/data/web_client.dart +++ b/lib/data/web_client.dart @@ -208,7 +208,7 @@ Map _getHeaders( } if ((password ?? '').isNotEmpty) { - headers['X-API-PASSWORD'] = password; + headers['X-API-PASSWORD-BASE64'] = base64Encode(utf8.encode(password)); } return headers; diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart index d5305fbf1..d0c1ce304 100644 --- a/lib/redux/app/app_state.dart +++ b/lib/redux/app/app_state.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'dart:ui'; +import 'package:invoiceninja_flutter/.env.dart'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; @@ -819,6 +820,21 @@ abstract class AppState implements Built { return isFullScreen; } + bool get hasRecentlyEnteredPassword { + if (Config.DEMO_MODE) { + return true; + } + + if (authState.lastEnteredPasswordAt == 0) { + return false; + } + + final millisecondsSinceEnteredPassword = + DateTime.now().millisecondsSinceEpoch - authState.lastEnteredPasswordAt; + + return millisecondsSinceEnteredPassword < company.passwordTimeout; + } + @override String toString() { final companyUpdated = userCompanyState.lastUpdated == null || @@ -865,7 +881,7 @@ abstract class AppState implements Built { '\nis Large: ${(company?.isLarge ?? false) ? 'Yes' : 'No'}' '\nCompany: $companyUpdated${userCompanyState.isStale ? ' [S]' : ''}' '\nStatic: $staticUpdated${staticState.isStale ? ' [S]' : ''}' - '\nPassword: $passwordUpdated${authState.hasRecentlyEnteredPassword ? '' : ' [S]'}' + '\nPassword: $passwordUpdated${hasRecentlyEnteredPassword ? '' : ' [S]'}' '\n'; } } diff --git a/lib/redux/auth/auth_state.dart b/lib/redux/auth/auth_state.dart index 33044b3ca..b8d3088ab 100644 --- a/lib/redux/auth/auth_state.dart +++ b/lib/redux/auth/auth_state.dart @@ -2,7 +2,6 @@ import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; import 'package:invoiceninja_flutter/constants.dart'; import 'package:invoiceninja_flutter/utils/formatting.dart'; -import 'package:invoiceninja_flutter/.env.dart'; part 'auth_state.g.dart'; @@ -39,19 +38,6 @@ abstract class AuthState implements Built { int get lastEnteredPasswordAt; - bool get hasRecentlyEnteredPassword { - if (Config.DEMO_MODE) { - return true; - } - - if (lastEnteredPasswordAt == 0) { - return false; - } - - return DateTime.now().millisecondsSinceEpoch - lastEnteredPasswordAt < - kMillisecondsToReenterPassword; - } - bool get isHosted { final cleanUrl = cleanApiUrl(url); diff --git a/lib/ui/auth/login_view.dart b/lib/ui/auth/login_view.dart index 81acc7e79..fe5732941 100644 --- a/lib/ui/auth/login_view.dart +++ b/lib/ui/auth/login_view.dart @@ -291,11 +291,10 @@ class _LoginState extends State { ScrollableListView( children: [ Padding( - padding: EdgeInsets.only(top: 20.0, bottom: 20.0), + padding: EdgeInsets.only(top: 25, bottom: 15), child: Center( child: InkWell( - child: Image.asset('assets/images/icon.png', - width: 100, height: 100), + child: Image.asset('assets/images/logo.png', height: 66), onTap: isApple() ? null : () { diff --git a/lib/utils/dialogs.dart b/lib/utils/dialogs.dart index 66fb3ed55..2fc87546c 100644 --- a/lib/utils/dialogs.dart +++ b/lib/utils/dialogs.dart @@ -146,7 +146,7 @@ void passwordCallback({ bool skipOAuth = false, }) { final state = StoreProvider.of(context).state; - if (state.authState.hasRecentlyEnteredPassword && !alwaysRequire) { + if (state.hasRecentlyEnteredPassword && !alwaysRequire) { callback(null, null); return; } else if (!state.user.hasPassword && skipOAuth) { diff --git a/pubspec.foss.yaml b/pubspec.foss.yaml index 84b6e7772..c953e20fe 100644 --- a/pubspec.foss.yaml +++ b/pubspec.foss.yaml @@ -85,5 +85,6 @@ flutter: assets: - assets/images/icon.png + - assets/images/logo.png - assets/images/google-icon.png - assets/images/payment_types/ diff --git a/pubspec.yaml b/pubspec.yaml index 9e2346fd7..f10e5201c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,5 +104,6 @@ flutter: assets: - assets/images/icon.png + - assets/images/logo.png - assets/images/google-icon.png - assets/images/payment_types/ \ No newline at end of file