remove to web vault url

This commit is contained in:
Kyle Spearrin 2017-08-28 18:08:26 -04:00
parent 910f0083cd
commit 5932dd99ad
7 changed files with 35 additions and 35 deletions

View file

@ -11,7 +11,7 @@ namespace Bit.App.Abstractions
bool AutofillPasswordField { get; set; } bool AutofillPasswordField { get; set; }
string SecurityStamp { get; set; } string SecurityStamp { get; set; }
string BaseUrl { get; set; } string BaseUrl { get; set; }
string VaultUrl { get; set; } string WebVaultUrl { get; set; }
string ApiUrl { get; set; } string ApiUrl { get; set; }
string IdentityUrl { get; set; } string IdentityUrl { get; set; }
} }

View file

@ -35,7 +35,7 @@
public const string LastSync = "other:lastSync"; public const string LastSync = "other:lastSync";
public const string LastBuildKey = "LastBuild"; public const string LastBuildKey = "LastBuild";
public const string BaseUrl = "other:baseUrl"; public const string BaseUrl = "other:baseUrl";
public const string VaultUrl = "other:vaultUrl"; public const string WebVaultUrl = "other:webVaultUrl";
public const string ApiUrl = "other:apiUrl"; public const string ApiUrl = "other:apiUrl";
public const string IdentityUrl = "other:identityUrl"; public const string IdentityUrl = "other:identityUrl";

View file

@ -26,7 +26,7 @@ namespace Bit.App.Pages
} }
public FormEntryCell BaseUrlCell { get; set; } public FormEntryCell BaseUrlCell { get; set; }
public FormEntryCell VaultUrlCell { get; set; } public FormEntryCell WebVaultUrlCell { get; set; }
public FormEntryCell ApiUrlCell { get; set; } public FormEntryCell ApiUrlCell { get; set; }
public FormEntryCell IdentityUrlCell { get; set; } public FormEntryCell IdentityUrlCell { get; set; }
public StackLayout StackLayout { get; set; } public StackLayout StackLayout { get; set; }
@ -41,9 +41,9 @@ namespace Bit.App.Pages
IdentityUrlCell.Entry.Text = _appSettings.IdentityUrl; IdentityUrlCell.Entry.Text = _appSettings.IdentityUrl;
ApiUrlCell = new FormEntryCell(AppResources.ApiUrl, nextElement: IdentityUrlCell.Entry, entryKeyboard: Keyboard.Url); ApiUrlCell = new FormEntryCell(AppResources.ApiUrl, nextElement: IdentityUrlCell.Entry, entryKeyboard: Keyboard.Url);
ApiUrlCell.Entry.Text = _appSettings.ApiUrl; ApiUrlCell.Entry.Text = _appSettings.ApiUrl;
VaultUrlCell = new FormEntryCell(AppResources.VaultUrl, nextElement: ApiUrlCell.Entry, entryKeyboard: Keyboard.Url); WebVaultUrlCell = new FormEntryCell(AppResources.WebVaultUrl, nextElement: ApiUrlCell.Entry, entryKeyboard: Keyboard.Url);
VaultUrlCell.Entry.Text = _appSettings.VaultUrl; WebVaultUrlCell.Entry.Text = _appSettings.WebVaultUrl;
BaseUrlCell = new FormEntryCell(AppResources.ServerUrl, nextElement: VaultUrlCell.Entry, entryKeyboard: Keyboard.Url); BaseUrlCell = new FormEntryCell(AppResources.ServerUrl, nextElement: WebVaultUrlCell.Entry, entryKeyboard: Keyboard.Url);
BaseUrlCell.Entry.Text = _appSettings.BaseUrl; BaseUrlCell.Entry.Text = _appSettings.BaseUrl;
var table = new FormTableView var table = new FormTableView
@ -72,7 +72,7 @@ namespace Bit.App.Pages
{ {
new TableSection(AppResources.CustomEnvironment) new TableSection(AppResources.CustomEnvironment)
{ {
VaultUrlCell, WebVaultUrlCell,
ApiUrlCell, ApiUrlCell,
IdentityUrlCell IdentityUrlCell
} }
@ -124,7 +124,7 @@ namespace Bit.App.Pages
BaseUrlCell.InitEvents(); BaseUrlCell.InitEvents();
IdentityUrlCell.InitEvents(); IdentityUrlCell.InitEvents();
ApiUrlCell.InitEvents(); ApiUrlCell.InitEvents();
VaultUrlCell.InitEvents(); WebVaultUrlCell.InitEvents();
StackLayout.LayoutChanged += Layout_LayoutChanged; StackLayout.LayoutChanged += Layout_LayoutChanged;
BaseUrlCell.Entry.FocusWithDelay(); BaseUrlCell.Entry.FocusWithDelay();
} }
@ -134,7 +134,7 @@ namespace Bit.App.Pages
BaseUrlCell.Dispose(); BaseUrlCell.Dispose();
IdentityUrlCell.Dispose(); IdentityUrlCell.Dispose();
ApiUrlCell.Dispose(); ApiUrlCell.Dispose();
VaultUrlCell.Dispose(); WebVaultUrlCell.Dispose();
StackLayout.LayoutChanged -= Layout_LayoutChanged; StackLayout.LayoutChanged -= Layout_LayoutChanged;
} }
@ -162,18 +162,18 @@ namespace Bit.App.Pages
BaseUrlCell.Entry.Text = null; BaseUrlCell.Entry.Text = null;
} }
if(!string.IsNullOrWhiteSpace(VaultUrlCell.Entry.Text)) if(!string.IsNullOrWhiteSpace(WebVaultUrlCell.Entry.Text))
{ {
VaultUrlCell.Entry.Text = FixUrl(VaultUrlCell.Entry.Text); WebVaultUrlCell.Entry.Text = FixUrl(WebVaultUrlCell.Entry.Text);
if(!Uri.TryCreate(VaultUrlCell.Entry.Text, UriKind.Absolute, out result)) if(!Uri.TryCreate(WebVaultUrlCell.Entry.Text, UriKind.Absolute, out result))
{ {
_userDialogs.Alert(string.Format(AppResources.FormattedIncorrectly, AppResources.VaultUrl)); _userDialogs.Alert(string.Format(AppResources.FormattedIncorrectly, AppResources.WebVaultUrl));
return; return;
} }
} }
else else
{ {
VaultUrlCell.Entry.Text = null; WebVaultUrlCell.Entry.Text = null;
} }
if(!string.IsNullOrWhiteSpace(ApiUrlCell.Entry.Text)) if(!string.IsNullOrWhiteSpace(ApiUrlCell.Entry.Text))
@ -207,7 +207,7 @@ namespace Bit.App.Pages
_appSettings.BaseUrl = BaseUrlCell.Entry.Text; _appSettings.BaseUrl = BaseUrlCell.Entry.Text;
_appSettings.IdentityUrl = IdentityUrlCell.Entry.Text; _appSettings.IdentityUrl = IdentityUrlCell.Entry.Text;
_appSettings.ApiUrl = ApiUrlCell.Entry.Text; _appSettings.ApiUrl = ApiUrlCell.Entry.Text;
_appSettings.VaultUrl = VaultUrlCell.Entry.Text; _appSettings.WebVaultUrl = WebVaultUrlCell.Entry.Text;
_userDialogs.Toast(AppResources.EnvironmentSaved); _userDialogs.Toast(AppResources.EnvironmentSaved);
_googleAnalyticsService.TrackAppEvent("SetEnvironmentUrls"); _googleAnalyticsService.TrackAppEvent("SetEnvironmentUrls");
await Navigation.PopForDeviceAsync(); await Navigation.PopForDeviceAsync();

View file

@ -187,19 +187,19 @@ namespace Bit.App.Pages
var host = WebUtility.UrlEncode(duoParams["Host"].ToString()); var host = WebUtility.UrlEncode(duoParams["Host"].ToString());
var req = WebUtility.UrlEncode(duoParams["Signature"].ToString()); var req = WebUtility.UrlEncode(duoParams["Signature"].ToString());
var vaultUrl = "https://vault.bitwarden.com"; var webVaultUrl = "https://vault.bitwarden.com";
if(!string.IsNullOrWhiteSpace(_appSettingsService.BaseUrl)) if(!string.IsNullOrWhiteSpace(_appSettingsService.BaseUrl))
{ {
vaultUrl = _appSettingsService.BaseUrl; webVaultUrl = _appSettingsService.BaseUrl;
} }
else if(!string.IsNullOrWhiteSpace(_appSettingsService.VaultUrl)) else if(!string.IsNullOrWhiteSpace(_appSettingsService.WebVaultUrl))
{ {
vaultUrl = _appSettingsService.VaultUrl; webVaultUrl = _appSettingsService.WebVaultUrl;
} }
var webView = new HybridWebView var webView = new HybridWebView
{ {
Uri = $"{vaultUrl}/duo-connector.html?host={host}&request={req}", Uri = $"{webVaultUrl}/duo-connector.html?host={host}&request={req}",
HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand,
MinimumHeightRequest = 400 MinimumHeightRequest = 400

View file

@ -2392,15 +2392,6 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Vault Server URL.
/// </summary>
public static string VaultUrl {
get {
return ResourceManager.GetString("VaultUrl", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Verification Code. /// Looks up a localized string similar to Verification Code.
/// </summary> /// </summary>
@ -2536,6 +2527,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Web Vault Server URL.
/// </summary>
public static string WebVaultUrl {
get {
return ResourceManager.GetString("WebVaultUrl", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Yes. /// Looks up a localized string similar to Yes.
/// </summary> /// </summary>

View file

@ -1024,7 +1024,7 @@
<data name="ServerUrl" xml:space="preserve"> <data name="ServerUrl" xml:space="preserve">
<value>Server URL</value> <value>Server URL</value>
</data> </data>
<data name="VaultUrl" xml:space="preserve"> <data name="WebVaultUrl" xml:space="preserve">
<value>Vault Server URL</value> <value>Web Vault Server URL</value>
</data> </data>
</root> </root>

View file

@ -104,21 +104,21 @@ namespace Bit.App.Services
} }
} }
public string VaultUrl public string WebVaultUrl
{ {
get get
{ {
return _settings.GetValueOrDefault<string>(Constants.VaultUrl); return _settings.GetValueOrDefault<string>(Constants.WebVaultUrl);
} }
set set
{ {
if(value == null) if(value == null)
{ {
_settings.Remove(Constants.VaultUrl); _settings.Remove(Constants.WebVaultUrl);
return; return;
} }
_settings.AddOrUpdateValue(Constants.VaultUrl, value); _settings.AddOrUpdateValue(Constants.WebVaultUrl, value);
} }
} }