[GDPR] Adjusted TOS/Privacy acceptance (#1138)

* GDPR acceptance flows

* Added specialized margin by platform

* Changed property name
This commit is contained in:
Vincent Salucci 2020-11-05 10:50:18 -06:00 committed by GitHub
parent 75b6e69d34
commit 82c96555dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 1 deletions

View file

@ -123,6 +123,39 @@
Text="{u:I18n MasterPasswordHintDescription}"
StyleClass="box-footer-label" />
</StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-switch"
IsVisible="{Binding ShowTerms}">
<Switch
IsToggled="{Binding AcceptPolicies}"
StyleClass="box-value"
HorizontalOptions="Start"
Margin="{Binding SwitchMargin}"/>
<Label StyleClass="box-footer-label"
HorizontalOptions="Fill">
<Label.FormattedText>
<FormattedString>
<Span Text="{u:I18n AcceptPolicies}" />
<Span Text="{u:I18n TermsOfService}"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
CommandParameter="https://bitwarden.com/terms/" />
</Span.GestureRecognizers>
</Span>
<Span Text=", " />
<Span Text="{u:I18n PrivacyPolicy}"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
CommandParameter="https://bitwarden.com/privacy/" />
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>

View file

@ -7,6 +7,7 @@ using Bit.Core.Models.Request;
using Bit.Core.Utilities;
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Bit.App.Pages
@ -18,6 +19,7 @@ namespace Bit.App.Pages
private readonly ICryptoService _cryptoService;
private readonly IPlatformUtilsService _platformUtilsService;
private bool _showPassword;
private bool _acceptPolicies;
public RegisterPageViewModel()
{
@ -30,8 +32,14 @@ namespace Bit.App.Pages
TogglePasswordCommand = new Command(TogglePassword);
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
SubmitCommand = new Command(async () => await SubmitAsync());
ShowTerms = !_platformUtilsService.IsSelfHost();
}
public ICommand PoliciesClickCommand => new Command<string>((url) =>
{
_platformUtilsService.LaunchUri(url);
});
public bool ShowPassword
{
get => _showPassword;
@ -42,6 +50,20 @@ namespace Bit.App.Pages
});
}
public bool AcceptPolicies
{
get => _acceptPolicies;
set => SetProperty(ref _acceptPolicies, value);
}
public Thickness SwitchMargin
{
get => Device.RuntimePlatform == Device.Android
? new Thickness(0, 0, 0, 0)
: new Thickness(0, 0, 10, 0);
}
public bool ShowTerms { get; set; }
public Command SubmitCommand { get; }
public Command TogglePasswordCommand { get; }
public Command ToggleConfirmPasswordCommand { get; }
@ -93,6 +115,12 @@ namespace Bit.App.Pages
AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok);
return;
}
if (ShowTerms && !AcceptPolicies)
{
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
AppResources.AcceptPoliciesError, AppResources.Ok);
return;
}
// TODO: Password strength check?

View file

@ -3050,5 +3050,29 @@ namespace Bit.App.Resources {
return ResourceManager.GetString("Loading", resourceCulture);
}
}
public static string AcceptPolicies {
get {
return ResourceManager.GetString("AcceptPolicies", resourceCulture);
}
}
public static string AcceptPoliciesError {
get {
return ResourceManager.GetString("AcceptPoliciesError", resourceCulture);
}
}
public static string TermsOfService {
get {
return ResourceManager.GetString("TermsOfService", resourceCulture);
}
}
public static string PrivacyPolicy {
get {
return ResourceManager.GetString("PrivacyPolicy", resourceCulture);
}
}
}
}

View file

@ -1731,4 +1731,17 @@
<data name="Loading" xml:space="preserve">
<value>Loading</value>
</data>
<data name="AcceptPolicies" xml:space="preserve">
<value>By activating this switch you agree to the following:
</value>
</data>
<data name="AcceptPoliciesError" xml:space="preserve">
<value>Terms of Service and Privacy Policy have not been acknowledged.</value>
</data>
<data name="TermsOfService" xml:space="preserve">
<value>Terms of Service</value>
</data>
<data name="PrivacyPolicy" xml:space="preserve">
<value>Privacy Policy</value>
</data>
</root>