1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-10 09:49:52 +01:00
bitwarden-mobile/src/App/Pages/Vault/CipherDetailsPageViewModel.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

714 lines
28 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using Bit.App.Abstractions;
using Bit.App.Lists.ItemViewModels.CustomFields;
2019-04-24 17:23:03 +02:00
using Bit.App.Resources;
2019-04-27 05:58:15 +02:00
using Bit.App.Utilities;
2022-01-21 10:31:03 +01:00
using Bit.Core;
2019-04-24 17:23:03 +02:00
using Bit.Core.Abstractions;
using Bit.Core.Enums;
2019-05-10 19:47:59 +02:00
using Bit.Core.Exceptions;
2019-04-24 17:23:03 +02:00
using Bit.Core.Models.View;
using Bit.Core.Utilities;
using Xamarin.CommunityToolkit.ObjectModel;
2019-04-26 06:26:09 +02:00
using Xamarin.Forms;
2019-04-24 17:23:03 +02:00
namespace Bit.App.Pages
{
public class CipherDetailsPageViewModel : BaseCipherViewModel, IPasswordPromptable
2019-04-24 17:23:03 +02:00
{
private readonly ICipherService _cipherService;
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
private readonly IStateService _stateService;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
private readonly IAuditService _auditService;
2019-04-26 06:26:09 +02:00
private readonly ITotpService _totpService;
2019-05-10 19:47:59 +02:00
private readonly IMessagingService _messagingService;
2019-07-12 23:29:40 +02:00
private readonly IEventService _eventService;
private readonly IPasswordRepromptService _passwordRepromptService;
private readonly ILocalizeService _localizeService;
private readonly ICustomFieldItemFactory _customFieldItemFactory;
private readonly IClipboardService _clipboardService;
EC-395 Apple Watch MVP (#2228) * [EC-426] Add watchOS PoC app (#2054) * EC-426 Added watchOS app, configured iOS.csproj to bundle the output of XCode build into the Xamarin iOS app and added some custom logic to use WCSession to communicate between the iOS and the watchOS apps * EC-426 Removed Info.plist from iOS.Core project given that it's not needed * [EC-426] Added new encrypted watch app profiles * EC-426 added configuration for building watchApp and bundle it up on the iOS one * EC-426 Fix build for watchOS * EC-426 Fix build for watchOS applied shell bash * EC-426 Fix build for watchOS echo * EC-426 Fix build for watchOS simplify * EC-426 Fix build for watchOS added workspace path * EC-426 Changed code sign identity of watchOS project to Apple Distribution * EC-426 added manual code sign style and specified the provisioning profile for the targets on the watch xcode project * EC-426 updated path to watchOS on release on iOS.csproj and disabled android and f-.droid * EC-426 fix build * EC-426 fix path and check listing of directory of watchOS output just in case * EC-426 Fix Apple Watch build to list the folder recursively just in case we need to change the path for the watch bundle * EC-426 TEMP Change texts on input on login and lock to show that the app is for the Watch PoC testing * EC-426 Fix WatchApp build path * EC-426 Added WatchOS AppIcons * EC-426 added gitignore for XCode project removed files supposed to be ignored * EC-426 Cleaned the code a bit to avoid misbehavior * EC-426 Code cleanup Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com> * [EC-585] Added data, encryption and some helpers and structure to the Watch app (#2164) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * [EC-614] Apple Watch MVP Cipher list UI (#2175) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * [EC-615] Apple Watch MVP Cipher details UI (#2192) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * EC-615 Added cipher details UI to watch and also implemented logic and helpers to generate the TOTPs * EC-615 Added value transformer to login uris on the cipher entity * EC-617 Added state view on watch app and some state helpers and wired it on the CipherListView. Also added some images (#2195) * [EC-581] Implement Apple Watch MVP Sync (#2206) * EC-581 Implemented sync iPhone -> watchOS, fix some issues with the watch database and sync flows for login/locks/multiple accounts * EC-581 Added watch sync on unlocking and need setup state when no user is synced and the session is not active * EC-581 Removed unused method * EC-581 Fix format * EC-759 Added avatar row on cipher list header to display avatar icon and email (#2213) * [EC-786] Apple Watch MVP Sync fixes (#2214) * EC-786 Commented things that are not going to be included on the MVP and fixed issue on the dictionary sent on the applicationContext to have a changing key based on time * EC-786 Commented need unlock state * EC-579 Added logic for Connect To Watch on iOS settings and moved it to the correct place. Also improved the synchronization and watch session activation logic (#2218) * EC-616 Added search header for ciphers and polished the code (#2226) Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com>
2022-12-07 17:39:20 +01:00
private readonly IWatchDeviceService _watchDeviceService;
private List<ICustomFieldItemViewModel> _fields;
2019-04-24 17:23:03 +02:00
private bool _canAccessPremium;
2019-04-27 05:37:21 +02:00
private bool _showPassword;
private bool _showCardNumber;
2019-04-27 05:37:21 +02:00
private bool _showCardCode;
2019-04-26 06:26:09 +02:00
private string _totpCode;
private string _totpCodeFormatted;
private string _totpSec;
private double _totpInterval = Constants.TotpDefaultTimer;
2019-04-26 06:26:09 +02:00
private bool _totpLow;
2019-07-12 23:29:40 +02:00
private string _previousCipherId;
private byte[] _attachmentData;
private string _attachmentFilename;
private bool _passwordReprompted;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
private TotpHelper _totpTickHelper;
private CancellationTokenSource _totpTickCancellationToken;
private Task _totpTickTask;
2019-04-24 17:23:03 +02:00
public CipherDetailsPageViewModel()
2019-04-24 17:23:03 +02:00
{
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
_auditService = ServiceContainer.Resolve<IAuditService>("auditService");
2019-04-26 06:26:09 +02:00
_totpService = ServiceContainer.Resolve<ITotpService>("totpService");
2019-05-10 19:47:59 +02:00
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
2019-07-12 23:29:40 +02:00
_eventService = ServiceContainer.Resolve<IEventService>("eventService");
_passwordRepromptService = ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService");
_localizeService = ServiceContainer.Resolve<ILocalizeService>("localizeService");
_customFieldItemFactory = ServiceContainer.Resolve<ICustomFieldItemFactory>("customFieldItemFactory");
_clipboardService = ServiceContainer.Resolve<IClipboardService>("clipboardService");
EC-395 Apple Watch MVP (#2228) * [EC-426] Add watchOS PoC app (#2054) * EC-426 Added watchOS app, configured iOS.csproj to bundle the output of XCode build into the Xamarin iOS app and added some custom logic to use WCSession to communicate between the iOS and the watchOS apps * EC-426 Removed Info.plist from iOS.Core project given that it's not needed * [EC-426] Added new encrypted watch app profiles * EC-426 added configuration for building watchApp and bundle it up on the iOS one * EC-426 Fix build for watchOS * EC-426 Fix build for watchOS applied shell bash * EC-426 Fix build for watchOS echo * EC-426 Fix build for watchOS simplify * EC-426 Fix build for watchOS added workspace path * EC-426 Changed code sign identity of watchOS project to Apple Distribution * EC-426 added manual code sign style and specified the provisioning profile for the targets on the watch xcode project * EC-426 updated path to watchOS on release on iOS.csproj and disabled android and f-.droid * EC-426 fix build * EC-426 fix path and check listing of directory of watchOS output just in case * EC-426 Fix Apple Watch build to list the folder recursively just in case we need to change the path for the watch bundle * EC-426 TEMP Change texts on input on login and lock to show that the app is for the Watch PoC testing * EC-426 Fix WatchApp build path * EC-426 Added WatchOS AppIcons * EC-426 added gitignore for XCode project removed files supposed to be ignored * EC-426 Cleaned the code a bit to avoid misbehavior * EC-426 Code cleanup Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com> * [EC-585] Added data, encryption and some helpers and structure to the Watch app (#2164) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * [EC-614] Apple Watch MVP Cipher list UI (#2175) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * [EC-615] Apple Watch MVP Cipher details UI (#2192) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * EC-615 Added cipher details UI to watch and also implemented logic and helpers to generate the TOTPs * EC-615 Added value transformer to login uris on the cipher entity * EC-617 Added state view on watch app and some state helpers and wired it on the CipherListView. Also added some images (#2195) * [EC-581] Implement Apple Watch MVP Sync (#2206) * EC-581 Implemented sync iPhone -> watchOS, fix some issues with the watch database and sync flows for login/locks/multiple accounts * EC-581 Added watch sync on unlocking and need setup state when no user is synced and the session is not active * EC-581 Removed unused method * EC-581 Fix format * EC-759 Added avatar row on cipher list header to display avatar icon and email (#2213) * [EC-786] Apple Watch MVP Sync fixes (#2214) * EC-786 Commented things that are not going to be included on the MVP and fixed issue on the dictionary sent on the applicationContext to have a changing key based on time * EC-786 Commented need unlock state * EC-579 Added logic for Connect To Watch on iOS settings and moved it to the correct place. Also improved the synchronization and watch session activation logic (#2218) * EC-616 Added search header for ciphers and polished the code (#2226) Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com>
2022-12-07 17:39:20 +01:00
_watchDeviceService = ServiceContainer.Resolve<IWatchDeviceService>();
CopyCommand = new AsyncCommand<string>((id) => CopyAsync(id, null), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
CopyUriCommand = new AsyncCommand<LoginUriView>(uriView => CopyAsync("LoginUri", uriView.Uri), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
CopyFieldCommand = new AsyncCommand<FieldView>(field => CopyAsync(field.Type == FieldType.Hidden ? "H_FieldValue" : "FieldValue", field.Value), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
LaunchUriCommand = new Command<ILaunchableView>(LaunchUri);
CloneCommand = new AsyncCommand(CloneAsync, onException: ex => HandleException(ex), allowsMultipleExecutions: false);
2019-04-27 05:37:21 +02:00
TogglePasswordCommand = new Command(TogglePassword);
ToggleCardNumberCommand = new Command(ToggleCardNumber);
2019-04-27 05:37:21 +02:00
ToggleCardCodeCommand = new Command(ToggleCardCode);
DownloadAttachmentCommand = new AsyncCommand<AttachmentView>(DownloadAttachmentAsync, allowsMultipleExecutions: false);
2019-04-24 17:23:03 +02:00
PageTitle = AppResources.ViewItem;
}
public ICommand CopyCommand { get; set; }
public ICommand CopyUriCommand { get; set; }
public ICommand CopyFieldCommand { get; set; }
2019-04-26 22:58:20 +02:00
public Command LaunchUriCommand { get; set; }
public ICommand CloneCommand { get; set; }
2019-04-27 05:37:21 +02:00
public Command TogglePasswordCommand { get; set; }
public Command ToggleCardNumberCommand { get; set; }
2019-04-27 05:37:21 +02:00
public Command ToggleCardCodeCommand { get; set; }
public AsyncCommand<AttachmentView> DownloadAttachmentCommand { get; set; }
2019-04-26 06:26:09 +02:00
public string CipherId { get; set; }
protected override string[] AdditionalPropertiesToRaiseOnCipherChanged => new string[]
{
nameof(IsLogin),
nameof(IsIdentity),
nameof(IsCard),
nameof(IsSecureNote),
nameof(ShowUris),
nameof(ShowAttachments),
nameof(ShowTotp),
nameof(ColoredPassword),
nameof(UpdatedText),
nameof(PasswordUpdatedText),
nameof(PasswordHistoryText),
nameof(ShowIdentityAddress),
nameof(IsDeleted),
nameof(CanEdit),
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
nameof(ShowUpgradePremiumTotpText)
};
public List<ICustomFieldItemViewModel> Fields
2019-04-27 03:53:39 +02:00
{
get => _fields;
set => SetProperty(ref _fields, value);
}
2019-04-24 17:23:03 +02:00
public bool CanAccessPremium
{
get => _canAccessPremium;
set => SetProperty(ref _canAccessPremium, value);
}
2019-04-27 05:37:21 +02:00
public bool ShowPassword
{
get => _showPassword;
set => SetProperty(ref _showPassword, value,
additionalPropertyNames: new string[]
{
nameof(ShowPasswordIcon),
nameof(PasswordVisibilityAccessibilityText)
2019-04-27 05:37:21 +02:00
});
}
public bool ShowCardNumber
{
get => _showCardNumber;
set => SetProperty(ref _showCardNumber, value,
additionalPropertyNames: new string[]
{
nameof(ShowCardNumberIcon)
});
}
2019-04-27 05:37:21 +02:00
public bool ShowCardCode
{
get => _showCardCode;
set => SetProperty(ref _showCardCode, value,
additionalPropertyNames: new string[]
{
nameof(ShowCardCodeIcon)
});
}
2019-04-29 20:35:44 +02:00
public bool IsLogin => Cipher?.Type == Core.Enums.CipherType.Login;
public bool IsIdentity => Cipher?.Type == Core.Enums.CipherType.Identity;
public bool IsCard => Cipher?.Type == Core.Enums.CipherType.Card;
public bool IsSecureNote => Cipher?.Type == Core.Enums.CipherType.SecureNote;
[SG-223] Mobile username generator (#2033) * SG-223 - Changed page title and password title * SG-223 - Refactored generated field * Changed position of generated field * Replaced buttons generate and copy for icons * SG-223 - Refactor type to passwordType * SG-223 - Added password or username selector * Added string for label type selection * SG-223 - Added logic for different types of username * Added strings of new types * [SG-223] - Added UI components for different username types * Added static strings for new labels * Added viewmodel properties to support username generation and their respective options * [SG-223] Added control over type picker visibility * [SG-223] Refactored username entry on add edit page and added generate icon * Added GenerateUsername command * [SG-223] - Implemented service for username generation * [SG-223] - Added support for username generation for item creation flow * Implemented cache for username options * Added exception handling for api calls * [SG-223] - Remove unused code * [SG-223] - Added a new display field for username generated and respective command * Added description label for each type of username * Changed defautl value of username from string.Empty to - * [SG-223] - Removed some StackLayouts and refactored some controls * [SG-223] - Refactored properties name * [SG-223] - Added visibility toggle icon for api keys of forwarded email username types * [SG-223] - Refactored nested StackLayouts into grids. * [SG-223] - Refactor and pr fixing * [SG-223] - Removed string keys from Resolve - Added static string to resources * [SG-223] - Refactored Copy_Clicked as AsyncCommand - Improved exception handling - Refactored TypeSelected as GeneratorTypeSelected * [SG-223] - Renamed PasswordFormatter * [SG-223] - Refactored VM properties to use UsernameGenerationOptions * Removed LoadUsernameOptions * [SG-223] - Refactored added pickers to use SelectedItem instead SelectedIndex * Deleted PickerIndexToBoolConverter as it isn't needed anymore * [SG-223] - Refactored and simplified Grid row and column definitions * [SG-223] - Refactored Command into async command * Added exception handling and feedback to the user * [SG-223] - Refactored GeneratorType picker to use Enum GeneratorType instead of string * [SG-223] - Changed some resource keys * [SG-223] - Refactor method name * [SG-223] - Refactored code and added logs for switch default cases * [SG-223] - Added flag to control visibility when in edit mode * [SG-223] - Added suffix Parenthesis to keys to prevent future conflicts * [SG-223] - Refactored multiple methods into one, GetUsernameFromAsync * Removed unused Extensions from enums * [SG-223] - Added exception message * [SG-223] - Added localizable enum values through LocalizableEnumConverter * [SG-223] - Fixed space between controls * [SG-223] - Removed unused code and refactored some variables and methods names * [SG-223] - Removed unused code and refactored constant name to be more elucidative * [SG-223] - Removed unused variable
2022-08-26 20:32:02 +02:00
public FormattedString ColoredPassword => GeneratedValueFormatter.Format(Cipher.Login.Password);
2019-04-30 15:50:35 +02:00
public FormattedString UpdatedText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.DateUpdated),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0} {1}",
_localizeService.GetLocaleShortDate(Cipher.RevisionDate.ToLocalTime()),
_localizeService.GetLocaleShortTime(Cipher.RevisionDate.ToLocalTime()))
2019-04-30 15:50:35 +02:00
});
return fs;
}
}
public FormattedString PasswordUpdatedText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.DatePasswordUpdated),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0} {1}",
_localizeService.GetLocaleShortDate(Cipher.PasswordRevisionDisplayDate?.ToLocalTime()),
_localizeService.GetLocaleShortTime(Cipher.PasswordRevisionDisplayDate?.ToLocalTime()))
2019-04-30 15:50:35 +02:00
});
return fs;
}
}
public FormattedString PasswordHistoryText
{
get
{
var fs = new FormattedString();
fs.Spans.Add(new Span
{
Text = string.Format("{0}:", AppResources.PasswordHistory),
FontAttributes = FontAttributes.Bold
});
fs.Spans.Add(new Span
{
Text = string.Format(" {0}", Cipher.PasswordHistory.Count.ToString()),
[Auto Logout] Final review of feature (#932) * Initial commit of LockService name refactor (#831) * [Auto-Logout] Update Service layer logic (#835) * Initial commit of service logic update * Added default value for action * Updated ToggleTokensAsync conditional * Removed unused variables, updated action conditional * Initial commit: lockOption/lock refactor app layer (#840) * [Auto-Logout] Settings Refactor - Application Layer Part 2 (#844) * Initial commit of app layer part 2 * Updated biometrics position * Reverted resource name refactor * LockOptions refactor revert * Updated method casing :: Removed VaultTimeout prefix for timeouts * Fixed dupe string resource (#854) * Updated dependency to use VaultTimeoutService (#896) * [Auto Logout] Xamarin Forms in AutoFill flow (iOS) (#902) * fix typo in PINRequireMasterPasswordRestart (#900) * initial commit for xf usage in autofill * Fixed databinding for hint button * Updated Two Factor page launch - removed unused imports * First pass at broadcast/messenger implentation for autofill * setting theme in extension using theme manager * extension app resources * App resources from main app * fix ref to twoFactorPage * apply resources to page * load empty app for sytling in extension * move ios renderers to ios core * static ref to resources and GetResourceColor helper * fix method ref * move application.current.resources refs to helper * switch login page alerts to device action dialogs * run on main thread * showDialog with device action service * abstract action sheet to device action service * add support for yubikey * add yubikey iimages to extension * support close button action * add support to action extension * remove empty lines Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [Auto Logout] Update lock option to be default value (#929) * Initial commit - make lock action default * Removed extra whitespace Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-05-29 18:26:36 +02:00
TextColor = ThemeManager.GetResourceColor("PrimaryColor")
2019-04-30 15:50:35 +02:00
});
return fs;
}
}
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
public bool ShowUpgradePremiumTotpText => !CanAccessPremium && !Cipher.OrganizationUseTotp && ShowTotp;
2019-04-29 20:35:44 +02:00
public bool ShowUris => IsLogin && Cipher.Login.HasUris;
2019-04-29 16:20:29 +02:00
public bool ShowIdentityAddress => IsIdentity && (
2019-04-29 20:35:44 +02:00
!string.IsNullOrWhiteSpace(Cipher.Identity.Address1) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.City) ||
!string.IsNullOrWhiteSpace(Cipher.Identity.Country));
public bool ShowAttachments => Cipher.HasAttachments && (CanAccessPremium || Cipher.OrganizationId != null);
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
public bool ShowTotp => IsLogin && !string.IsNullOrWhiteSpace(Cipher.Login.Totp);
2022-01-21 10:31:03 +01:00
public string ShowPasswordIcon => ShowPassword ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
public string ShowCardNumberIcon => ShowCardNumber ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
public string ShowCardCodeIcon => ShowCardCode ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
public string PasswordVisibilityAccessibilityText => ShowPassword ? AppResources.PasswordIsVisibleTapToHide : AppResources.PasswordIsNotVisibleTapToShow;
2019-04-26 06:26:09 +02:00
public string TotpCodeFormatted
{
get => ShowUpgradePremiumTotpText ? string.Empty : _totpCodeFormatted;
2019-04-26 22:58:20 +02:00
set => SetProperty(ref _totpCodeFormatted, value,
additionalPropertyNames: new string[]
{
nameof(ShowTotp)
});
2019-04-26 06:26:09 +02:00
}
public string TotpSec
{
get => _totpSec;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
set => SetProperty(ref _totpSec, value,
additionalPropertyNames: new string[]
{
nameof(TotpProgress)
});
2019-04-26 06:26:09 +02:00
}
public bool TotpLow
{
get => _totpLow;
set
{
SetProperty(ref _totpLow, value);
[Auto Logout] Final review of feature (#932) * Initial commit of LockService name refactor (#831) * [Auto-Logout] Update Service layer logic (#835) * Initial commit of service logic update * Added default value for action * Updated ToggleTokensAsync conditional * Removed unused variables, updated action conditional * Initial commit: lockOption/lock refactor app layer (#840) * [Auto-Logout] Settings Refactor - Application Layer Part 2 (#844) * Initial commit of app layer part 2 * Updated biometrics position * Reverted resource name refactor * LockOptions refactor revert * Updated method casing :: Removed VaultTimeout prefix for timeouts * Fixed dupe string resource (#854) * Updated dependency to use VaultTimeoutService (#896) * [Auto Logout] Xamarin Forms in AutoFill flow (iOS) (#902) * fix typo in PINRequireMasterPasswordRestart (#900) * initial commit for xf usage in autofill * Fixed databinding for hint button * Updated Two Factor page launch - removed unused imports * First pass at broadcast/messenger implentation for autofill * setting theme in extension using theme manager * extension app resources * App resources from main app * fix ref to twoFactorPage * apply resources to page * load empty app for sytling in extension * move ios renderers to ios core * static ref to resources and GetResourceColor helper * fix method ref * move application.current.resources refs to helper * switch login page alerts to device action dialogs * run on main thread * showDialog with device action service * abstract action sheet to device action service * add support for yubikey * add yubikey iimages to extension * support close button action * add support to action extension * remove empty lines Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> * [Auto Logout] Update lock option to be default value (#929) * Initial commit - make lock action default * Removed extra whitespace Co-authored-by: Jonas Kittner <54631600+theendlessriver13@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-05-29 18:26:36 +02:00
Page.Resources["textTotp"] = ThemeManager.Resources()[value ? "text-danger" : "text-default"];
}
2019-04-26 06:26:09 +02:00
}
public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / _totpInterval;
public bool IsDeleted => Cipher.IsDeleted;
public bool CanEdit => !Cipher.IsDeleted;
public bool CanClone => Cipher.IsClonable;
2019-04-24 17:23:03 +02:00
2019-06-05 23:25:12 +02:00
public async Task<bool> LoadAsync(Action finishedLoadingAction = null)
2019-04-24 17:23:03 +02:00
{
var cipher = await _cipherService.GetAsync(CipherId);
if (cipher == null)
2019-05-30 14:40:10 +02:00
{
2019-06-05 23:25:12 +02:00
finishedLoadingAction?.Invoke();
2019-05-30 14:40:10 +02:00
return false;
}
2019-04-24 17:23:03 +02:00
Cipher = await cipher.DecryptAsync();
Account Switching (#1807) * Account Switching (#1720) * Account switching * WIP * wip * wip * updates to send test logic * fixed Send tests * fixes for theme handling on account switching and re-adding existing account * switch fixes * fixes * fixes * cleanup * vault timeout fixes * account list status enhancements * logout fixes and token handling improvements * merge latest (#1727) * remove duplicate dependency * fix for initial login token storage paradox (#1730) * Fix avatar color update toolbar item issue on iOS for account switching (#1735) * Updated account switching menu UI (#1733) * updated account switching menu UI * additional changes * add key suffix to constant * GetFirstLetters method tweaks * Fix crash on account switching when logging out when having more than user at a time (#1740) * single account migration to multi-account on app update (#1741) * Account Switching Tap to dismiss (#1743) * Added tap to dismiss on the Account switching overlay and improved a bit the code * Fix account switching overlay background transparent on the proper place * Fixed transparent background and the shadow on the account switching overlay * Fix iOS top space on Account switching list overlay after modal (#1746) * Fix top space added to Account switching list overlay after closing modal * Fix top space added to Account switching list overlay after closing modal on lock, login and home views just in case we add modals in the future there as well * Usability: dismiss account list on certain events (#1748) * dismiss account list on certain events * use new FireAndForget method for back button logic * Create and use Account Switching overlay control (#1753) * Added Account switching overlay control and its own ViewModel and refactored accordingly * Fix account switching Accounts list binding update * Implemented dismiss account switching overlay when changing tabs and when selecting the same tab. Also updated the deprecated listener on CustomTabbedRenderer on Android (#1755) * Overriden Equals on AvatarImageSource so it doesn't get set multiple times when it's the same image thus producing blinking on tab chaged (#1756) * Usability improvements for logout on vault timeout (#1781) * accountswitching fixes (#1784) * Fix for invalid PIN lock state when switching accounts (#1792) * fix for pin lock flow * named tuple values and updated async * clear send service cache on account switch (#1796) * Global theme and account removal (#1793) * Global theme and account removal * remove redundant call to hide account list overlay * cleanup and additional tweaks * add try/catch to remove account dialog flow Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2022-02-23 18:40:17 +01:00
CanAccessPremium = await _stateService.CanAccessPremiumAsync();
Fields = Cipher.Fields?
.Select(f => _customFieldItemFactory.CreateCustomFieldItem(f, false, Cipher, this, CopyFieldCommand, null))
.ToList();
2019-04-24 17:23:03 +02:00
if (Cipher.Type == Core.Enums.CipherType.Login && !string.IsNullOrWhiteSpace(Cipher.Login.Totp) &&
2019-04-26 06:26:09 +02:00
(Cipher.OrganizationUseTotp || CanAccessPremium))
{
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
_totpTickHelper = new TotpHelper(Cipher);
_totpTickCancellationToken?.Cancel();
_totpInterval = _totpTickHelper.Interval;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
_totpTickCancellationToken = new CancellationTokenSource();
_totpTickTask = new TimerTask(_logger, StartCiphersTotpTick, _totpTickCancellationToken).RunPeriodic();
2019-04-26 06:26:09 +02:00
}
if (_previousCipherId != CipherId)
2019-07-12 23:29:40 +02:00
{
var task = _eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientViewed, CipherId);
}
_previousCipherId = CipherId;
2019-06-05 23:25:12 +02:00
finishedLoadingAction?.Invoke();
2019-05-30 14:40:10 +02:00
return true;
2019-04-26 06:26:09 +02:00
}
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
private async void StartCiphersTotpTick()
2019-04-26 06:26:09 +02:00
{
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
try
{
await _totpTickHelper.GenerateNewTotpValues();
TotpSec = _totpTickHelper.TotpSec;
TotpCodeFormatted = _totpTickHelper.TotpCodeFormatted;
_totpInterval = _totpTickHelper.Interval;
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
}
catch (Exception ex)
{
_logger.Exception(ex);
}
}
public async Task StopCiphersTotpTick()
{
_totpTickCancellationToken?.Cancel();
if (_totpTickTask != null)
{
await _totpTickTask;
}
2019-04-26 06:26:09 +02:00
}
public async void TogglePassword()
2019-04-27 05:37:21 +02:00
{
if (!await PromptPasswordAsync())
{
return;
}
2019-04-27 05:37:21 +02:00
ShowPassword = !ShowPassword;
if (ShowPassword)
2019-07-12 23:29:40 +02:00
{
var task = _eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientToggledPasswordVisible, CipherId);
}
2019-04-27 05:37:21 +02:00
}
public async void ToggleCardNumber()
{
if (!await PromptPasswordAsync())
{
return;
}
ShowCardNumber = !ShowCardNumber;
if (ShowCardNumber)
{
var task = _eventService.CollectAsync(
Core.Enums.EventType.Cipher_ClientToggledCardNumberVisible, CipherId);
}
}
public async void ToggleCardCode()
2019-04-27 05:37:21 +02:00
{
if (!await PromptPasswordAsync())
{
return;
}
2019-04-27 05:37:21 +02:00
ShowCardCode = !ShowCardCode;
if (ShowCardCode)
2019-07-12 23:29:40 +02:00
{
var task = _eventService.CollectAsync(
Core.Enums.EventType.Cipher_ClientToggledCardCodeVisible, CipherId);
}
2019-04-27 05:37:21 +02:00
}
2019-05-10 19:47:59 +02:00
public async Task<bool> DeleteAsync()
{
if (Xamarin.Essentials.Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None)
{
await _platformUtilsService.ShowDialogAsync(AppResources.InternetConnectionRequiredMessage,
AppResources.InternetConnectionRequiredTitle);
return false;
}
var confirmed = await _platformUtilsService.ShowDialogAsync(
Cipher.IsDeleted ? AppResources.DoYouReallyWantToPermanentlyDeleteCipher : AppResources.DoYouReallyWantToSoftDeleteCipher,
2019-05-30 14:35:50 +02:00
null, AppResources.Yes, AppResources.Cancel);
if (!confirmed)
2019-05-10 19:47:59 +02:00
{
return false;
}
try
{
await _deviceActionService.ShowLoadingAsync(Cipher.IsDeleted ? AppResources.Deleting : AppResources.SoftDeleting);
if (Cipher.IsDeleted)
{
await _cipherService.DeleteWithServerAsync(Cipher.Id);
}
else
{
await _cipherService.SoftDeleteWithServerAsync(Cipher.Id);
}
await _deviceActionService.HideLoadingAsync();
EC-395 Apple Watch MVP (#2228) * [EC-426] Add watchOS PoC app (#2054) * EC-426 Added watchOS app, configured iOS.csproj to bundle the output of XCode build into the Xamarin iOS app and added some custom logic to use WCSession to communicate between the iOS and the watchOS apps * EC-426 Removed Info.plist from iOS.Core project given that it's not needed * [EC-426] Added new encrypted watch app profiles * EC-426 added configuration for building watchApp and bundle it up on the iOS one * EC-426 Fix build for watchOS * EC-426 Fix build for watchOS applied shell bash * EC-426 Fix build for watchOS echo * EC-426 Fix build for watchOS simplify * EC-426 Fix build for watchOS added workspace path * EC-426 Changed code sign identity of watchOS project to Apple Distribution * EC-426 added manual code sign style and specified the provisioning profile for the targets on the watch xcode project * EC-426 updated path to watchOS on release on iOS.csproj and disabled android and f-.droid * EC-426 fix build * EC-426 fix path and check listing of directory of watchOS output just in case * EC-426 Fix Apple Watch build to list the folder recursively just in case we need to change the path for the watch bundle * EC-426 TEMP Change texts on input on login and lock to show that the app is for the Watch PoC testing * EC-426 Fix WatchApp build path * EC-426 Added WatchOS AppIcons * EC-426 added gitignore for XCode project removed files supposed to be ignored * EC-426 Cleaned the code a bit to avoid misbehavior * EC-426 Code cleanup Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com> * [EC-585] Added data, encryption and some helpers and structure to the Watch app (#2164) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * [EC-614] Apple Watch MVP Cipher list UI (#2175) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * [EC-615] Apple Watch MVP Cipher details UI (#2192) * [EC-585] Added foundation classes on the watch to handle CoreData and some fixes on the communication of the ciphers, also some helper classes to store in keychain and encrypt data * EC-585 Added keychain helper, encryption helpers and added data storage using CoreData configuring it appropiately. View and ViewModel are here only to test that the fetching/saving works but it's not the actual UI of the watch app. Also removed all the places where the automatic file signature was added by XCode * EC-585 Fixed CipherServiceMock to implement protocol * EC-585 Fixed DeviceActionService duplicated services * EC-614 Implemented watch ciphers list UI * EC-615 Added cipher details UI to watch and also implemented logic and helpers to generate the TOTPs * EC-615 Added value transformer to login uris on the cipher entity * EC-617 Added state view on watch app and some state helpers and wired it on the CipherListView. Also added some images (#2195) * [EC-581] Implement Apple Watch MVP Sync (#2206) * EC-581 Implemented sync iPhone -> watchOS, fix some issues with the watch database and sync flows for login/locks/multiple accounts * EC-581 Added watch sync on unlocking and need setup state when no user is synced and the session is not active * EC-581 Removed unused method * EC-581 Fix format * EC-759 Added avatar row on cipher list header to display avatar icon and email (#2213) * [EC-786] Apple Watch MVP Sync fixes (#2214) * EC-786 Commented things that are not going to be included on the MVP and fixed issue on the dictionary sent on the applicationContext to have a changing key based on time * EC-786 Commented need unlock state * EC-579 Added logic for Connect To Watch on iOS settings and moved it to the correct place. Also improved the synchronization and watch session activation logic (#2218) * EC-616 Added search header for ciphers and polished the code (#2226) Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com>
2022-12-07 17:39:20 +01:00
_watchDeviceService.SyncDataToWatchAsync().FireAndForget();
_platformUtilsService.ShowToast("success", null,
Cipher.IsDeleted ? AppResources.ItemDeleted : AppResources.ItemSoftDeleted);
_messagingService.Send(Cipher.IsDeleted ? "deletedCipher" : "softDeletedCipher", Cipher);
return true;
}
catch (ApiException e)
{
await _deviceActionService.HideLoadingAsync();
if (e?.Error != null)
{
await _platformUtilsService.ShowDialogAsync(e.Error.GetSingleMessage(),
AppResources.AnErrorHasOccurred);
}
}
return false;
}
public async Task<bool> RestoreAsync()
{
if (!IsDeleted)
{
return false;
}
if (Xamarin.Essentials.Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None)
{
await _platformUtilsService.ShowDialogAsync(AppResources.InternetConnectionRequiredMessage,
AppResources.InternetConnectionRequiredTitle);
return false;
}
var confirmed = await _platformUtilsService.ShowDialogAsync(AppResources.DoYouReallyWantToRestoreCipher,
null, AppResources.Yes, AppResources.Cancel);
if (!confirmed)
{
return false;
}
try
{
await _deviceActionService.ShowLoadingAsync(AppResources.Restoring);
await _cipherService.RestoreWithServerAsync(Cipher.Id);
2019-05-10 19:47:59 +02:00
await _deviceActionService.HideLoadingAsync();
_platformUtilsService.ShowToast("success", null, AppResources.ItemRestored);
_messagingService.Send("restoredCipher", Cipher);
2019-05-10 19:47:59 +02:00
return true;
}
catch (ApiException e)
2019-05-10 19:47:59 +02:00
{
await _deviceActionService.HideLoadingAsync();
if (e?.Error != null)
2019-10-22 22:37:40 +02:00
{
await _platformUtilsService.ShowDialogAsync(e.Error.GetSingleMessage(),
AppResources.AnErrorHasOccurred);
}
2019-05-10 19:47:59 +02:00
}
return false;
}
2019-04-26 06:26:09 +02:00
private async Task TotpUpdateCodeAsync()
{
if (Cipher == null || Cipher.Type != Core.Enums.CipherType.Login || Cipher.Login.Totp == null)
2019-04-26 06:26:09 +02:00
{
return;
}
_totpCode = await _totpService.GetCodeAsync(Cipher.Login.Totp);
if (_totpCode != null)
2019-04-26 06:26:09 +02:00
{
if (_totpCode.Length > 4)
2019-04-26 06:26:09 +02:00
{
var half = (int)Math.Floor(_totpCode.Length / 2M);
TotpCodeFormatted = string.Format("{0} {1}", _totpCode.Substring(0, half),
_totpCode.Substring(half));
}
else
{
TotpCodeFormatted = _totpCode;
}
}
else
{
TotpCodeFormatted = null;
}
}
private async Task TotpTickAsync(int intervalSeconds)
{
var epoc = CoreHelpers.EpocUtcNow() / 1000;
var mod = epoc % intervalSeconds;
var totpSec = intervalSeconds - mod;
TotpSec = totpSec.ToString();
TotpLow = totpSec < 7;
if (mod == 0)
2019-04-26 06:26:09 +02:00
{
await TotpUpdateCodeAsync();
}
}
private async Task DownloadAttachmentAsync(AttachmentView attachment)
2019-04-27 06:19:44 +02:00
{
try
{
if (Xamarin.Essentials.Connectivity.NetworkAccess == Xamarin.Essentials.NetworkAccess.None)
{
await _platformUtilsService.ShowDialogAsync(AppResources.InternetConnectionRequiredMessage,
AppResources.InternetConnectionRequiredTitle);
return;
}
if (Cipher.OrganizationId == null && !CanAccessPremium)
{
await _platformUtilsService.ShowDialogAsync(AppResources.PremiumRequired);
return;
}
if (attachment.FileSize >= 10485760) // 10 MB
{
var confirmed = await _platformUtilsService.ShowDialogAsync(
string.Format(AppResources.AttachmentLargeWarning, attachment.SizeName), null,
AppResources.Yes, AppResources.No);
if (!confirmed)
{
return;
}
}
var canOpenFile = true;
if (!_fileService.CanOpenFile(attachment.FileName))
{
if (Device.RuntimePlatform == Device.iOS)
{
// iOS is currently hardcoded to always return CanOpenFile == true, but should it ever return false
// for any reason we want to be sure to catch it here.
await _platformUtilsService.ShowDialogAsync(AppResources.UnableToOpenFile);
return;
}
canOpenFile = false;
}
2021-06-11 15:20:21 +02:00
if (!await PromptPasswordAsync())
{
return;
}
await _deviceActionService.ShowLoadingAsync(AppResources.Downloading);
var data = await _cipherService.DownloadAndDecryptAttachmentAsync(Cipher.Id, attachment, Cipher.OrganizationId);
await _deviceActionService.HideLoadingAsync();
if (data == null)
{
await _platformUtilsService.ShowDialogAsync(AppResources.UnableToDownloadFile);
return;
}
if (Device.RuntimePlatform == Device.Android)
{
if (canOpenFile)
{
// We can open this attachment directly, so give the user the option to open or save
PromptOpenOrSave(data, attachment);
}
else
{
// We can't open this attachment so go directly to save
SaveAttachment(data, attachment);
}
}
else
{
OpenAttachment(data, attachment);
}
}
catch (Exception ex)
{
_logger.Exception(ex);
await _deviceActionService.HideLoadingAsync();
await _platformUtilsService.ShowDialogAsync(AppResources.AnErrorHasOccurred);
}
2019-04-29 20:35:44 +02:00
}
public async void PromptOpenOrSave(byte[] data, AttachmentView attachment)
{
var selection = await Page.DisplayActionSheet(attachment.FileName, AppResources.Cancel, null,
AppResources.Open, AppResources.Save);
if (selection == AppResources.Open)
{
OpenAttachment(data, attachment);
}
else if (selection == AppResources.Save)
{
SaveAttachment(data, attachment);
}
}
public async void OpenAttachment(byte[] data, AttachmentView attachment)
{
if (!_fileService.OpenFile(data, attachment.Id, attachment.FileName))
{
await _platformUtilsService.ShowDialogAsync(AppResources.UnableToOpenFile);
return;
}
}
public async void SaveAttachment(byte[] data, AttachmentView attachment)
{
_attachmentData = data;
_attachmentFilename = attachment.FileName;
if (!_fileService.SaveFile(_attachmentData, null, _attachmentFilename, null))
{
ClearAttachmentData();
await _platformUtilsService.ShowDialogAsync(AppResources.UnableToSaveAttachment);
}
}
public async void SaveFileSelected(string contentUri, string filename)
{
if (_fileService.SaveFile(_attachmentData, null, filename ?? _attachmentFilename, contentUri))
{
ClearAttachmentData();
_platformUtilsService.ShowToast("success", null, AppResources.SaveAttachmentSuccess);
return;
}
ClearAttachmentData();
await _platformUtilsService.ShowDialogAsync(AppResources.UnableToSaveAttachment);
}
private void ClearAttachmentData()
{
_attachmentData = null;
_attachmentFilename = null;
}
2022-04-26 17:21:17 +02:00
private async Task CopyAsync(string id, string text = null)
2019-04-26 06:26:09 +02:00
{
if (_passwordRepromptService.ProtectedFields.Contains(id) && !await PromptPasswordAsync())
{
return;
}
2019-04-26 06:26:09 +02:00
string name = null;
if (id == "LoginUsername")
2019-04-26 06:26:09 +02:00
{
text = Cipher.Login.Username;
name = AppResources.Username;
}
else if (id == "LoginPassword")
2019-04-26 06:26:09 +02:00
{
text = Cipher.Login.Password;
name = AppResources.Password;
}
else if (id == "LoginTotp")
2019-04-26 06:26:09 +02:00
{
[SG-416] Updates to Bitwarden Authenticator (Feature Branch) (#2041) * Initial commit of new TOTP page * Revert config files from previous commit This reverts commit b02c58e3623781ada1e9e8f820b403a5c48274aa. * clear extra code and fix build * add tab page * add authentication view cell * add toolbar icons * got the countdown working * enable context loading and vm init * PS-70 Added toggle to quickly filter TOTP cypher items and show their details, Added new text resource * PS-70 removed old authentication tab * removed unnecessary code on vm * fixed formatting * PS-70 Added circular progress to the OTP count down * PS-70 Fixed grid cell width. Added red progress at 20 percent. Refactored circular progress view. * PS-70 Added new props to custom control. * PS-70 show toggle only if it's premium * PS-70 removed unnecessary code * PS-70 add copy to clipboard. * PS-70 show upgrade to premium text on details to free user. * PS-70 added text labels to resource files * PS-70 Renamed TOTP to Totp to have consistency in naming. Removed a11y text of switch because android was overlapping text. * PS-70 added new UI to enter code manually in the QR Code scanner screen. Changed existing labels on scanner screen. * PS-70 Splited totp code to adjust spacing. * PS-70 Added scanner square corner overlay. Added scanning animation. Added scan success animation. * PS-70 let zxing scanner camera feed on until screen is closed. * PS-70 fixed scanner animation for android devices * PS-70 added vibrate permission to manifest. refactored scanpage code. added manual authentication key feature in scanner. * PS-70 fixed totp cell title label font * PS-70 added copy button to totp edit cipher. Added row button when totp is null. * PS-70 changed labels on manual scanner screen * PS-70 Added label on top of button to solve UI bug. * PS-70 Fixed android button overlapping bug by adding button styling to a Frame view and placing a label inside. Fixed Color on scanner page. * PS-70 Added frame styling for iOS, since frame view has different base configuration for android and iOS. * PS-70 fixed font clipping bug on iOS * PS-70 removed shadow for newer versions of android * PS-70 code format * PS-70 removed update to premium uri launch * PS-70 PR fix for AppResource vs code behind generation. * PS-70 changed premium required label. fixed bug when to show premium required label. * [SSG-416] Removed the dashes from free user and just left the Premium subscription required. * [SSG-416] removed unnecessary changes to the TabsPage file * [SSG-416] removed unnecessary using. * [SSG-416] Updated ViewPageViewModel and code refactoring. * [SG-416] Updated scanner mode toggle text color to be inline with figma designs * [SSG-416] Mobile PR Fixes * [SSG-416] Add to remove a11y text from totp toggle because on android it places an helper text next to the switch making it invisible. Also removed from the label because it already reads the text from the label * [SSG-416] run dotnet tool run dotnet-format * [SSG-416] PR fixes * Revert "[SSG-416] PR fixes" This reverts commit 2f2b90aceed81944e6a2737d5b4409d6798dc9da. * [PS-416] Fixed a bug where the item details page was not updating after saving. * [SG-416] Authenticator toggle remake (#2027) * [SG-416] Removed toggle to TOTP. Added on MainPage new entry to go to screen with TOTP codes. Added filter for TOTP codes to be used when searching. * [SG-416] Removed unnecessary code. Added nav back if there is only 1 cipher with totp code and the user removes it. * [SG-416] Run dotnet format tool * [SG-416] PR fixes * [SG-416] PR Fixes. Manifest formatting. Add try catch. Extracted method and added null protection. * [SG-416] Make TOTP codes appear above favourites. * [SG-416] PR fixes. Show error dialog. Co-authored-by: Carlos J. Muentes <42616259+cmuentes@users.noreply.github.com> Co-authored-by: Jacob Fink <jfink@bitwarden.com>
2022-08-17 23:10:16 +02:00
text = TotpCodeFormatted.Replace(" ", string.Empty);
2019-04-26 06:26:09 +02:00
name = AppResources.VerificationCodeTotp;
}
else if (id == "LoginUri")
2019-04-26 22:58:20 +02:00
{
name = AppResources.URI;
}
else if (id == "FieldValue" || id == "H_FieldValue")
2019-04-29 19:51:05 +02:00
{
name = AppResources.Value;
}
else if (id == "CardNumber")
2019-04-29 16:20:29 +02:00
{
text = Cipher.Card.Number;
name = AppResources.Number;
}
else if (id == "CardCode")
2019-04-29 16:20:29 +02:00
{
text = Cipher.Card.Code;
name = AppResources.SecurityCode;
}
2019-04-26 06:26:09 +02:00
if (text != null)
2019-04-26 06:26:09 +02:00
{
await _clipboardService.CopyTextAsync(text);
if (!string.IsNullOrWhiteSpace(name))
2019-04-26 06:26:09 +02:00
{
_platformUtilsService.ShowToastForCopiedValue(name);
2019-04-26 06:26:09 +02:00
}
if (id == "LoginPassword")
2019-07-12 23:29:40 +02:00
{
await _eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientCopiedPassword, CipherId);
}
else if (id == "CardCode")
2019-07-12 23:29:40 +02:00
{
await _eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientCopiedCardCode, CipherId);
}
else if (id == "H_FieldValue")
2019-07-12 23:29:40 +02:00
{
await _eventService.CollectAsync(Core.Enums.EventType.Cipher_ClientCopiedHiddenField, CipherId);
}
2019-04-26 06:26:09 +02:00
}
2019-04-24 17:23:03 +02:00
}
2019-04-26 22:58:20 +02:00
private void LaunchUri(ILaunchableView launchableView)
{
if (launchableView.CanLaunch && (Page as BaseContentPage).DoOnce())
{
_platformUtilsService.LaunchUri(launchableView.LaunchUri);
}
}
private async Task CloneAsync()
2019-04-26 22:58:20 +02:00
{
if (!await CanCloneAsync() || !await PromptPasswordAsync())
2019-04-26 22:58:20 +02:00
{
return;
2019-04-26 22:58:20 +02:00
}
var page = new CipherAddEditPage(CipherId, cloneMode: true, cipherDetailsPage: Page as CipherDetailsPage);
await Page.Navigation.PushModalAsync(new NavigationPage(page));
2019-04-26 22:58:20 +02:00
}
public async Task<bool> PromptPasswordAsync()
{
Trusted Device Encryption feature (#2656) * [PM-1208] Add Device approval options screen. View model waiting for additional logic to be added. * [PM-1208] Add device related api endpoint. Add AccoundDecryptOptions model and property to user Account. * [PM-1208] Add continue button and not you option * [PM-1379] add DeviceTrustCryptoService with establish trust logic (#2535) * [PM-1379] add DeviceCryptoService with establish trust logic * PM-1379 update api location and other minor refactors * pm-1379 fix encoding * update trusted device keys api call to Put * [PM-1379] rename DeviceCryptoService to DeviceTrustCryptoService - refactors to prevent side effects * [PM-1379] rearrange methods in DeviceTrustCryptoService * [PM-1379] rearrange methods in abstraction * [PM-1379] deconstruct tuples * [PM-1379] remove extra tasks * [PM-2583] Answer auth request with mp field as null if doesn't have it. (#2609) * [PM-2287][PM-2289][PM-2293] Approval Options (#2608) * [PM-2293] Add AuthRequestType to PasswordlessLoginPage. * [PM-2293] Add Actions to ApproveWithDevicePage * [PM-2293] Change screen text based on AuthRequestType * [PM-2293] Refactor AuthRequestType enum. Add label. Remove unnecessary actions. * [PM-2293] Change boolean variable expression. * [PM-2293] Trust device after admin request login. * code format * [PM-2287] Add trust device to master password unlock. Change trust device method. Remove email from SSO login page. * [PM-2293] Fix state variable get set. * [PM-2287][PM-2289][PM-2293] Rename method * [PM-1201] Change timeout actions available based on hasMasterPassword (#2610) * [PM-1201] Change timeout actions available based on hasMasterPassword * [PM-2731] add user key and master key types * [PM-2713] add new state for new keys and obsolete old ones - UserKey - MasterKey - UserKeyMasterKey (enc UserKey from User Table) * [PM-271] add UserKey and MasterKey support to crypto service * [PM-2713] rename key hash to password hash & begin add methods to crypto service * [PM-2713] continue organizing crypto service * [PM-2713] more updates to crypto service * [PM-2713] add new pin methods to state service * [PM-2713] fix signature of GetUserKeyPin * [PM-2713] add make user key method to crypto service * [PM-2713] refresh pin key when setting user key * [PM-2713] use new MakeMasterKey method * [PM-2713] add toggle method to crypto service for keys * [PM-2713] converting calls to new crypto service api * [PM-2713] add migration for pin on lock screens * [PM-2713] more conversions to new crypto service api * [PM-2713] convert cipher service and others to crypto service api * [PM-2713] More conversions to crypto api * [PM-2713] use new crypto service api in auth service * [PM-2713] remove unused cached values in crypto service * [PM-2713] set decrypt and set user key in login helper * fix bad merge * Update crypto service api call to fix build * [PM-1208] Fix app resource file * [PM-1208] Fix merge * [PM-1208] Fix merge * [PM-2713] optimize async code in crypto service * [PM-2713] rename password hash to master key hash * [PM-2713] fix casting issues and pin * [PM-2713] remove extra comment * [PM-2713] remove broken casting * [PM-2297] Login with trusted device (Flow 2) (#2623) * [PM-2297] Add DecryptUserKeyWithDeviceKey method * [PM-2297] Add methods to DeviceTrustCryptoService update decryption options model * [PM-2297] Update account decryption options model * [PM-2297] Fix TrustedDeviceOption and DeviceResponse model. Change StateService device key get set to have default user id * [PM-2297] Update navigation to decryption options * [PM-2297] Add missing action navigations to iOS extensions * [PM-2297] Fix trust device bug/typo * [PM-2297] Fix model bug * [PM-2297] Fix state var crash * [PM-2297] Add trust device login logic to auth service * [PM-2297] Refactor auth service key connector code * [PM-2297] Remove reconciledOptions for deviceKey in state service * [PM-2297] Remove unnecessary user id params * [PM-2289] [PM-2293] TDE Login with device Admin Request (#2642) * [PM-2713] deconstruct new key pair * [PM-2713] rename PrivateKey methods to UserPrivateKey on crypto service * [PM-2713] rename PinLockEnum to PinLockType * [PM-2713] don't pass user key as param when encrypting * [PM-2713] rename toggle method, don't reset enc user key * [PM-2713] pr feedback * [PM-2713] PR feedback * [PM-2713] rename get pin lock type method * [PM-2713] revert feedback for build * [PM-2713] rename state methods * [PM-2713] combine makeDataEncKey methods * [PM-2713] consolidate attachment key creation - also fix ios files missed during symbol rename * [PM-2713] replace generic with inherited class * rename account keys to be more descriptive * [PM-2713] add auto unlock key to mobile * [PM-1208] Add TDE flows for new users (#2655) * [PM-1208] Create new user on SSO. Logout if not password is setup or has pending admin auth request. * [PM-1208] Fix new user UserKey decryption. * [PM-1208] Add new user continue to vault logic. Auto enrol user on continue. * [PM-1208] Trust device only if needed * [PM-1208] Add logic for New User SSO. * [PM-1208] Add logic for New User SSO (missing file). * [PM-2713] set user key on set password page * [PM-2713] set enc user key during kc onboarding * fix formatting * [PM-2713] make method async again - returning null from a task thats not async throws * [PM-2713] clear service cache when adding new account * Fix build after merge * [PM-3313] Fix Android SSO Login (#2663) * [PM-3313] Catch exception on AuthPendingRequest * [PM-3313] Fix lock timeout action if user doesn't have a master password. * code format * [PM-3313] Null email in Approval Options screen (#2664) * [PM-3313] Fix null email in approval options screen * [PM-3320][PM-3321] Fix labels and UI tweaks (#2666) * [PM-3320] Fix UI copy and remember me default ON. * [PM-3321] Fix UI on Log in with device screen. * [PM-3337] Fix admin request deny error (#2669) * [PM-3342] Not you button logs user out. (#2672) * [PM-3319] Check for admin request in Lock page (#2668) * [PM-3319] Ignore admin auth request when choosing mp as decryption option. * [PM-2289] Change header title based on auth request type (#2670) * [PM-2289] Change header title based on auth request type * [PM-3333] Check for purged admin auth requests (#2671) * [PM-3333] Check for purged admin auth requests Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * [PM-3341] Vault Timeout Action not persisted correctly (#2673) * [PM-3341] Fix timeout action change when navigating * [PM-3357] Fix copy for Login Initiated (#2674) * [PM-3362] Fix auth request approval (#2675) * [PM-3362] Fix auth request approval * [PM-3362] Add new exception type * [PM-3102] Update Master password reprompt to be based on MP instead of Key Connector (#2653) * PM-3102 Added check to see if a user has master password set replacing previous usage of key connector. * PM-3102 Fix formatting * [PM-2713] Final merge from Key Migration branch to TDE Feature branch (#2667) * [PM-2713] add async to key connector service methods * [PM-2713] rename ephemeral pin key * add state for biometric key and accept UserKey instead of string for auto key * Get UserKey from bio state on unlock * PM-2713 Fix auto-migrating EncKeyEncrypted into MasterKey encrypted UserKey when requesting DecryptUserKeyWithMasterKeyAsync is called * renaming bio key and fix build * PM-3194 Fix biometrics button to be shown on upgrade when no UserKey is present yet * revert removal of key connector service from auth service * PM-2713 set user key when using KC * clear enc user key after migration * use is true for nullable bool * PR feedback, refactor kc service --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * Fix app fresh install user login with master password. (#2676) * [PM-3303] Fix biometric login after key migration (#2679) * [PM-3303] Add condition to biometric unlock * [PM-3381] Fix TDE login 2FA flow (#2678) * [PM-3381] Check for vault lock on 2FA screen * [PM-3381] Move logic to ViewModel * [PM-3381] Fix null vm error * [PM-3379] Fix key rotation on trusted device. (#2680) * [PM-3381] Update login flows (#2683) * [PM-3381] Update login flows * [PM-3381] Remove _authingWithSso parameter * PM-3385 Fix MP reprompt item level when no MP hash is stored like logging in with TDE. Also refactor code to be more maintainable (#2687) * PM-3386 Fix MP reprompt / OTP decision to be also based on the master key hash. (#2688) * PM-3450 Fix has master password with mp key hash check (#2689) * [PM-3394] Fix login with device for passwordless approvals (#2686) * set activeUserId to null when logging in a new account - Also stop the user key from being set in inactive accounts * get token for login with device if approving device doesn't have master key * add comment * simplify logic * check for route instead of using isAuthenticated - we don't clear the user id when logging in new account - this means we can't trust the state service, so we have to base our logic off the route in login with device * use authenticated auth request for tde login with device * [PM-3394] Add authingWithSso parameter to LoginPasswordlessRequestPage. * pr feedback * [PM-3394] Refactor condition Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: André Bispo <abispo@bitwarden.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * [PM-3462] Handle force password reset on mobile with TDE (#2694) * [PM-3462] Handle force password reset on mobile with TDE * [PM-3462] update references to refactored crypto method - fix kc bug, we were sending private key instead of user key to server - rename kc service method to be correct * [PM-3462] Update TwoFactorPage login logic * [PM-3462] Added pending admin request check to TwoFactorPage * [PM-3462] Added new exception types for null keys --------- Co-authored-by: André Bispo <abispo@bitwarden.com> * [PM-1029] Fix Async suffix in ApiService. Add UserKeyNullExceptions. * [PM 3513] Fix passwordless 2fa login with device on mobile (#2700) * [PM-3513] Fix 2FA for normal login with device with users without mp * move _userKey --------- Co-authored-by: André Bispo <abispo@bitwarden.com> * clear encrypted pin on logout (#2699) --------- Co-authored-by: André Bispo <abispo@bitwarden.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2023-08-17 21:19:35 +02:00
if (_passwordReprompted)
{
return true;
}
Trusted Device Encryption feature (#2656) * [PM-1208] Add Device approval options screen. View model waiting for additional logic to be added. * [PM-1208] Add device related api endpoint. Add AccoundDecryptOptions model and property to user Account. * [PM-1208] Add continue button and not you option * [PM-1379] add DeviceTrustCryptoService with establish trust logic (#2535) * [PM-1379] add DeviceCryptoService with establish trust logic * PM-1379 update api location and other minor refactors * pm-1379 fix encoding * update trusted device keys api call to Put * [PM-1379] rename DeviceCryptoService to DeviceTrustCryptoService - refactors to prevent side effects * [PM-1379] rearrange methods in DeviceTrustCryptoService * [PM-1379] rearrange methods in abstraction * [PM-1379] deconstruct tuples * [PM-1379] remove extra tasks * [PM-2583] Answer auth request with mp field as null if doesn't have it. (#2609) * [PM-2287][PM-2289][PM-2293] Approval Options (#2608) * [PM-2293] Add AuthRequestType to PasswordlessLoginPage. * [PM-2293] Add Actions to ApproveWithDevicePage * [PM-2293] Change screen text based on AuthRequestType * [PM-2293] Refactor AuthRequestType enum. Add label. Remove unnecessary actions. * [PM-2293] Change boolean variable expression. * [PM-2293] Trust device after admin request login. * code format * [PM-2287] Add trust device to master password unlock. Change trust device method. Remove email from SSO login page. * [PM-2293] Fix state variable get set. * [PM-2287][PM-2289][PM-2293] Rename method * [PM-1201] Change timeout actions available based on hasMasterPassword (#2610) * [PM-1201] Change timeout actions available based on hasMasterPassword * [PM-2731] add user key and master key types * [PM-2713] add new state for new keys and obsolete old ones - UserKey - MasterKey - UserKeyMasterKey (enc UserKey from User Table) * [PM-271] add UserKey and MasterKey support to crypto service * [PM-2713] rename key hash to password hash & begin add methods to crypto service * [PM-2713] continue organizing crypto service * [PM-2713] more updates to crypto service * [PM-2713] add new pin methods to state service * [PM-2713] fix signature of GetUserKeyPin * [PM-2713] add make user key method to crypto service * [PM-2713] refresh pin key when setting user key * [PM-2713] use new MakeMasterKey method * [PM-2713] add toggle method to crypto service for keys * [PM-2713] converting calls to new crypto service api * [PM-2713] add migration for pin on lock screens * [PM-2713] more conversions to new crypto service api * [PM-2713] convert cipher service and others to crypto service api * [PM-2713] More conversions to crypto api * [PM-2713] use new crypto service api in auth service * [PM-2713] remove unused cached values in crypto service * [PM-2713] set decrypt and set user key in login helper * fix bad merge * Update crypto service api call to fix build * [PM-1208] Fix app resource file * [PM-1208] Fix merge * [PM-1208] Fix merge * [PM-2713] optimize async code in crypto service * [PM-2713] rename password hash to master key hash * [PM-2713] fix casting issues and pin * [PM-2713] remove extra comment * [PM-2713] remove broken casting * [PM-2297] Login with trusted device (Flow 2) (#2623) * [PM-2297] Add DecryptUserKeyWithDeviceKey method * [PM-2297] Add methods to DeviceTrustCryptoService update decryption options model * [PM-2297] Update account decryption options model * [PM-2297] Fix TrustedDeviceOption and DeviceResponse model. Change StateService device key get set to have default user id * [PM-2297] Update navigation to decryption options * [PM-2297] Add missing action navigations to iOS extensions * [PM-2297] Fix trust device bug/typo * [PM-2297] Fix model bug * [PM-2297] Fix state var crash * [PM-2297] Add trust device login logic to auth service * [PM-2297] Refactor auth service key connector code * [PM-2297] Remove reconciledOptions for deviceKey in state service * [PM-2297] Remove unnecessary user id params * [PM-2289] [PM-2293] TDE Login with device Admin Request (#2642) * [PM-2713] deconstruct new key pair * [PM-2713] rename PrivateKey methods to UserPrivateKey on crypto service * [PM-2713] rename PinLockEnum to PinLockType * [PM-2713] don't pass user key as param when encrypting * [PM-2713] rename toggle method, don't reset enc user key * [PM-2713] pr feedback * [PM-2713] PR feedback * [PM-2713] rename get pin lock type method * [PM-2713] revert feedback for build * [PM-2713] rename state methods * [PM-2713] combine makeDataEncKey methods * [PM-2713] consolidate attachment key creation - also fix ios files missed during symbol rename * [PM-2713] replace generic with inherited class * rename account keys to be more descriptive * [PM-2713] add auto unlock key to mobile * [PM-1208] Add TDE flows for new users (#2655) * [PM-1208] Create new user on SSO. Logout if not password is setup or has pending admin auth request. * [PM-1208] Fix new user UserKey decryption. * [PM-1208] Add new user continue to vault logic. Auto enrol user on continue. * [PM-1208] Trust device only if needed * [PM-1208] Add logic for New User SSO. * [PM-1208] Add logic for New User SSO (missing file). * [PM-2713] set user key on set password page * [PM-2713] set enc user key during kc onboarding * fix formatting * [PM-2713] make method async again - returning null from a task thats not async throws * [PM-2713] clear service cache when adding new account * Fix build after merge * [PM-3313] Fix Android SSO Login (#2663) * [PM-3313] Catch exception on AuthPendingRequest * [PM-3313] Fix lock timeout action if user doesn't have a master password. * code format * [PM-3313] Null email in Approval Options screen (#2664) * [PM-3313] Fix null email in approval options screen * [PM-3320][PM-3321] Fix labels and UI tweaks (#2666) * [PM-3320] Fix UI copy and remember me default ON. * [PM-3321] Fix UI on Log in with device screen. * [PM-3337] Fix admin request deny error (#2669) * [PM-3342] Not you button logs user out. (#2672) * [PM-3319] Check for admin request in Lock page (#2668) * [PM-3319] Ignore admin auth request when choosing mp as decryption option. * [PM-2289] Change header title based on auth request type (#2670) * [PM-2289] Change header title based on auth request type * [PM-3333] Check for purged admin auth requests (#2671) * [PM-3333] Check for purged admin auth requests Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * [PM-3341] Vault Timeout Action not persisted correctly (#2673) * [PM-3341] Fix timeout action change when navigating * [PM-3357] Fix copy for Login Initiated (#2674) * [PM-3362] Fix auth request approval (#2675) * [PM-3362] Fix auth request approval * [PM-3362] Add new exception type * [PM-3102] Update Master password reprompt to be based on MP instead of Key Connector (#2653) * PM-3102 Added check to see if a user has master password set replacing previous usage of key connector. * PM-3102 Fix formatting * [PM-2713] Final merge from Key Migration branch to TDE Feature branch (#2667) * [PM-2713] add async to key connector service methods * [PM-2713] rename ephemeral pin key * add state for biometric key and accept UserKey instead of string for auto key * Get UserKey from bio state on unlock * PM-2713 Fix auto-migrating EncKeyEncrypted into MasterKey encrypted UserKey when requesting DecryptUserKeyWithMasterKeyAsync is called * renaming bio key and fix build * PM-3194 Fix biometrics button to be shown on upgrade when no UserKey is present yet * revert removal of key connector service from auth service * PM-2713 set user key when using KC * clear enc user key after migration * use is true for nullable bool * PR feedback, refactor kc service --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * Fix app fresh install user login with master password. (#2676) * [PM-3303] Fix biometric login after key migration (#2679) * [PM-3303] Add condition to biometric unlock * [PM-3381] Fix TDE login 2FA flow (#2678) * [PM-3381] Check for vault lock on 2FA screen * [PM-3381] Move logic to ViewModel * [PM-3381] Fix null vm error * [PM-3379] Fix key rotation on trusted device. (#2680) * [PM-3381] Update login flows (#2683) * [PM-3381] Update login flows * [PM-3381] Remove _authingWithSso parameter * PM-3385 Fix MP reprompt item level when no MP hash is stored like logging in with TDE. Also refactor code to be more maintainable (#2687) * PM-3386 Fix MP reprompt / OTP decision to be also based on the master key hash. (#2688) * PM-3450 Fix has master password with mp key hash check (#2689) * [PM-3394] Fix login with device for passwordless approvals (#2686) * set activeUserId to null when logging in a new account - Also stop the user key from being set in inactive accounts * get token for login with device if approving device doesn't have master key * add comment * simplify logic * check for route instead of using isAuthenticated - we don't clear the user id when logging in new account - this means we can't trust the state service, so we have to base our logic off the route in login with device * use authenticated auth request for tde login with device * [PM-3394] Add authingWithSso parameter to LoginPasswordlessRequestPage. * pr feedback * [PM-3394] Refactor condition Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: André Bispo <abispo@bitwarden.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * [PM-3462] Handle force password reset on mobile with TDE (#2694) * [PM-3462] Handle force password reset on mobile with TDE * [PM-3462] update references to refactored crypto method - fix kc bug, we were sending private key instead of user key to server - rename kc service method to be correct * [PM-3462] Update TwoFactorPage login logic * [PM-3462] Added pending admin request check to TwoFactorPage * [PM-3462] Added new exception types for null keys --------- Co-authored-by: André Bispo <abispo@bitwarden.com> * [PM-1029] Fix Async suffix in ApiService. Add UserKeyNullExceptions. * [PM 3513] Fix passwordless 2fa login with device on mobile (#2700) * [PM-3513] Fix 2FA for normal login with device with users without mp * move _userKey --------- Co-authored-by: André Bispo <abispo@bitwarden.com> * clear encrypted pin on logout (#2699) --------- Co-authored-by: André Bispo <abispo@bitwarden.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
2023-08-17 21:19:35 +02:00
return _passwordReprompted = await _passwordRepromptService.PromptAndCheckPasswordIfNeededAsync(Cipher.Reprompt);
}
private async Task<bool> CanCloneAsync()
{
if (!Cipher.HasFido2Credential)
{
return true;
}
return await _platformUtilsService.ShowDialogAsync(AppResources.ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem, AppResources.PasskeyWillNotBeCopied, AppResources.Yes, AppResources.No);
}
2019-04-24 17:23:03 +02:00
}
}