diff --git a/app/Constants.php b/app/Constants.php index 198ec32113..1b7c7e02b7 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -341,6 +341,8 @@ if (! defined('APP_NAME')) { define('MSBOT_STATE_URL', 'https://state.botframework.com/v3'); define('INVOICEPLANE_IMPORT', 'https://github.com/turbo124/Plane2Ninja'); + define('TIME_TRACKER_USER_AGENT', 'Time Tracker'); + define('BOT_PLATFORM_WEB_APP', 'WebApp'); define('BOT_PLATFORM_SKYPE', 'Skype'); diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 0e13c9227d..15c87890b8 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -110,6 +110,19 @@ } else { $('#email').focus(); } + + @if (array_get($_SERVER, 'HTTP_USER_AGENT') == TIME_TRACKER_USER_AGENT) + if (isStorageSupported()) { + $('#email').change(function() { + localStorage.setItem('last:time_tracker:email', $('#email').val()); + }) + var email = localStorage.getItem('last:time_tracker:email'); + if (email) { + $('#email').val(email); + $('#password').focus(); + } + } + @endif }) diff --git a/resources/views/tasks/time_tracker.blade.php b/resources/views/tasks/time_tracker.blade.php index 581ec104c6..cd3edd9e6d 100644 --- a/resources/views/tasks/time_tracker.blade.php +++ b/resources/views/tasks/time_tracker.blade.php @@ -571,7 +571,7 @@ toastr.options.timeOut = 3000; toastr.options.positionClass = 'toast-bottom-right'; - if (navigator.userAgent != 'Time Tracker') { + if (navigator.userAgent != '{{ TIME_TRACKER_USER_AGENT }}') { var link = '{{ config('ninja.time_tracker_web_url') }}'; var message = "{{ trans('texts.download_desktop_app') }}"; if (isMobile) {