From e72ccaf440148c4fae13cc1663876f50fd6457cf Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Tue, 13 Oct 2020 15:01:14 -0500 Subject: [PATCH] Initial commit for new user provision flow (#1091) --- src/App/Pages/Accounts/LoginSsoPage.xaml.cs | 4 ++-- src/App/Pages/Accounts/SetPasswordPage.xaml.cs | 3 ++- src/App/Pages/Accounts/SetPasswordPageViewModel.cs | 2 ++ src/App/Pages/Accounts/TwoFactorPage.xaml.cs | 6 ++++-- src/Core/Models/Request/SetPasswordRequest.cs | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs index 675676bcd..c30853d2c 100644 --- a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs @@ -93,14 +93,14 @@ namespace Bit.App.Pages private async Task StartTwoFactorAsync() { RestoreAppOptionsFromCopy(); - var page = new TwoFactorPage(true, _appOptions); + var page = new TwoFactorPage(true, _appOptions, _vm.OrgIdentifier); await Navigation.PushModalAsync(new NavigationPage(page)); } private async Task StartSetPasswordAsync() { RestoreAppOptionsFromCopy(); - var page = new SetPasswordPage(_appOptions); + var page = new SetPasswordPage(_appOptions, _vm.OrgIdentifier); await Navigation.PushModalAsync(new NavigationPage(page)); } diff --git a/src/App/Pages/Accounts/SetPasswordPage.xaml.cs b/src/App/Pages/Accounts/SetPasswordPage.xaml.cs index 8b351d35a..6f7d3c82b 100644 --- a/src/App/Pages/Accounts/SetPasswordPage.xaml.cs +++ b/src/App/Pages/Accounts/SetPasswordPage.xaml.cs @@ -14,7 +14,7 @@ namespace Bit.App.Pages private readonly SetPasswordPageViewModel _vm; private readonly AppOptions _appOptions; - public SetPasswordPage(AppOptions appOptions = null) + public SetPasswordPage(AppOptions appOptions = null, string orgIdentifier = null) { _messagingService = ServiceContainer.Resolve("messagingService"); _messagingService.Send("showStatusBar", true); @@ -29,6 +29,7 @@ namespace Bit.App.Pages _messagingService.Send("showStatusBar", false); await Navigation.PopModalAsync(); }; + _vm.OrgIdentifier = orgIdentifier; if (Device.RuntimePlatform == Device.Android) { ToolbarItems.RemoveAt(0); diff --git a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs index be7f7d5b6..815a7ccd4 100644 --- a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs +++ b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs @@ -85,6 +85,7 @@ namespace Bit.App.Pages public string Hint { get; set; } public Action SetPasswordSuccessAction { get; set; } public Action CloseAction { get; set; } + public string OrgIdentifier { get; set; } public async Task InitAsync() { @@ -158,6 +159,7 @@ namespace Bit.App.Pages MasterPasswordHint = Hint, Kdf = kdf, KdfIterations = kdfIterations, + OrgIdentifier = OrgIdentifier, Keys = new KeysRequest { PublicKey = keys.Item1, diff --git a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs index 3d7a3b2e2..2dd87b16b 100644 --- a/src/App/Pages/Accounts/TwoFactorPage.xaml.cs +++ b/src/App/Pages/Accounts/TwoFactorPage.xaml.cs @@ -20,13 +20,15 @@ namespace Bit.App.Pages private TwoFactorPageViewModel _vm; private bool _inited; private bool _authingWithSso; + private string _orgIdentifier; - public TwoFactorPage(bool? authingWithSso = false, AppOptions appOptions = null) + public TwoFactorPage(bool? authingWithSso = false, AppOptions appOptions = null, string orgIdentifier = null) { InitializeComponent(); SetActivityIndicator(); _authingWithSso = authingWithSso ?? false; _appOptions = appOptions; + _orgIdentifier = orgIdentifier; _storageService = ServiceContainer.Resolve("storageService"); _broadcasterService = ServiceContainer.Resolve("broadcasterService"); _messagingService = ServiceContainer.Resolve("messagingService"); @@ -170,7 +172,7 @@ namespace Bit.App.Pages private async Task StartSetPasswordAsync() { _vm.CloseAction(); - var page = new SetPasswordPage(_appOptions); + var page = new SetPasswordPage(_appOptions, _orgIdentifier); await Navigation.PushModalAsync(new NavigationPage(page)); } diff --git a/src/Core/Models/Request/SetPasswordRequest.cs b/src/Core/Models/Request/SetPasswordRequest.cs index 5682af3ce..28db2ab4e 100644 --- a/src/Core/Models/Request/SetPasswordRequest.cs +++ b/src/Core/Models/Request/SetPasswordRequest.cs @@ -10,5 +10,6 @@ namespace Bit.Core.Models.Request public KeysRequest Keys { get; set; } public KdfType Kdf { get; set; } public int KdfIterations { get; set; } + public string OrgIdentifier { get; set; } } }