Support for Registration Lock PINs

This commit is contained in:
Moxie Marlinspike
2018-03-01 09:51:37 -08:00
parent d28dc670ea
commit 110d33ddf8
22 changed files with 930 additions and 120 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -63,7 +63,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="visible">
tools:visibility="invisible">
<TextView android:id="@+id/backup_created_text"
android:layout_width="wrap_content"
@@ -256,6 +256,89 @@
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<LinearLayout android:id="@+id/pin_container"
android:padding="16dp"
android:paddingBottom="0dp"
android:layout_marginTop="30dp"
android:layout_below="@id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:visibility="invisible"
tools:visibility="visible">
<LinearLayout android:id="@+id/pin_clarification_container"
android:visibility="gone"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
tools:visibility="visible">
<TextView android:id="@+id/clarification_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="-2dp"
android:layout_gravity="center_vertical"
android:textColor="#73B7F0"
android:text="@string/registration_activity__the_registration_lock_pin_is_not_the_same_as_the_sms_verification_code_you_just_received_please_enter_the_pin_you_previously_configured_in_the_application"/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="100dp"
android:paddingRight="100dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:imeOptions="actionDone"
android:hint="@string/registration_activity__registration_lock_pin"/>
</android.support.design.widget.TextInputLayout>
<com.dd.CircularProgressButton
android:id="@+id/pinButton"
app:cpb_textIdle="Continue"
app:cpb_selectorIdle="@drawable/progress_button_state"
app:cpb_colorIndicator="@color/white"
app:cpb_colorProgress="@color/textsecure_primary"
app:cpb_cornerRadius="50dp"
android:background="@color/signal_primary"
android:textColor="@color/white"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="40dp"
android:layout_gravity="center_horizontal"/>
<TextView android:id="@+id/forgot_button"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="15dp"
android:textColor="@color/blue_400"
android:text="@string/registration_activity__forgot_pin"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingLeft="23dp"
android:paddingRight="23dp"
android:animateLayoutChanges="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/registration_lock_dialog_view__the_pin_can_consist_of_four_or_more_digits_if_you_forget_your_pin_you_could_be_locked_out_of_your_account_for_up_to_seven_days"/>
<android.support.design.widget.TextInputLayout
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:imeOptions="actionNext"
android:hint="@string/registration_lock_dialog_view__enter_pin"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/repeat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:imeOptions="actionDone"
android:hint="@string/registration_lock_dialog_view__confirm_pin"/>
</android.support.design.widget.TextInputLayout>
<ProgressBar android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/header_container"
android:background="@color/signal_primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:padding="40dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/registration_lock_reminder_view__enter_your_registration_lock_pin"/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:paddingLeft="80dp"
android:paddingRight="80dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:hint="@string/registration_lock_reminder_view__enter_pin"/>
</android.support.design.widget.TextInputLayout>
<TextView android:id="@+id/reminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:paddingBottom="40dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textSize="15sp"
android:lineSpacingMultiplier="1.3"
tools:text="Registration Lock is enabled for your phone number. I forgot my PIN."/>
</LinearLayout>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:animateLayoutChanges="true">
<ProgressBar android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard_view"
@@ -38,6 +39,18 @@
android:gravity="center_vertical"
android:src="@drawable/ic_close_white_48dp"/>
<org.thoughtcrime.securesms.components.SquareImageView
android:id="@+id/locked"
android:layout_width="96dp"
android:layout_height="96dp"
android:padding="10dp"
android:layout_gravity="center"
android:background="@drawable/circle_tintable"
android:backgroundTint="@color/green_400"
android:gravity="center_vertical"
android:src="@drawable/ic_lock_white_48dp"
android:visibility="gone"
tools:visibility="visible"/>
</merge>

View File

@@ -39,7 +39,7 @@
<string name="ApplicationPreferencesActivity_off">off</string>
<string name="ApplicationPreferencesActivity_Off">Off</string>
<string name="ApplicationPreferencesActivity_sms_mms_summary">SMS %1$s, MMS %2$s</string>
<string name="ApplicationPreferencesActivity_privacy_summary">Screen lock %1$s, Screen security %2$s</string>
<string name="ApplicationPreferencesActivity_privacy_summary">Screen lock %1$s, Registration lock %2$s</string>
<string name="ApplicationPreferencesActivity_appearance_summary">Theme %1$s, Language %2$s</string>
<!-- AppProtectionPreferenceFragment -->
@@ -1365,8 +1365,37 @@
<string name="preferences_app_protection__lock_signal_access_with_android_screen_lock_or_fingerprint">Lock Signal access with Android screen lock or fingerprint</string>
<string name="preferences_app_protection__screen_lock_inactivity_timeout">Screen lock inactivity timeout</string>
<string name="AppProtectionPreferenceFragment_none">None</string>
<string name="registration_activity__the_registration_lock_pin_is_not_the_same_as_the_sms_verification_code_you_just_received_please_enter_the_pin_you_previously_configured_in_the_application">The Registration Lock PIN is not the same as the SMS verification code you just received. Please enter the PIN you previously configured in the application.</string>
<string name="registration_activity__registration_lock_pin">Registration Lock PIN</string>
<string name="registration_activity__forgot_pin">Forgot PIN?</string>
<string name="registration_lock_dialog_view__the_pin_can_consist_of_four_or_more_digits_if_you_forget_your_pin_you_could_be_locked_out_of_your_account_for_up_to_seven_days">The PIN can consist of four or more digits. If you forget your PIN, you could be locked out of your account for up to seven days.</string>
<string name="registration_lock_dialog_view__enter_pin">Enter PIN</string>
<string name="registration_lock_dialog_view__confirm_pin">Confirm PIN</string>
<string name="registration_lock_reminder_view__enter_your_registration_lock_pin">Enter your Registration Lock PIN</string>
<string name="registration_lock_reminder_view__enter_pin">Enter PIN</string>
<string name="preferences_app_protection__enable_a_registration_lock_pin_that_will_be_required">Enable a Registration Lock PIN that will be required to register this phone number with Signal again.</string>
<string name="preferences_app_protection__registration_lock_pin">Registration Lock PIN</string>
<string name="preferences_app_protection__registration_lock">Registration Lock</string>
<string name="RegistrationActivity_you_must_enter_your_registration_lock_PIN">You must enter your Registration Lock PIN</string>
<string name="RegistrationActivity_incorrect_registration_lock_pin">Incorrect Registration Lock PIN</string>
<string name="RegistrationActivity_too_many_attempts">Too many attempts</string>
<string name="RegistrationActivity_you_have_made_too_many_incorrect_registration_lock_pin_attempts_please_try_again_in_a_day">You\'ve made too many incorrect Registration Lock PIN attempts. Please try again in a day.</string>
<string name="RegistrationActivity_error_connecting_to_service">Error connecting to service</string>
<string name="RegistrationActivity_oh_no">Oh no!</string>
<string name="RegistrationActivity_registration_of_this_phone_number_will_be_possible_without_your_registration_lock_pin_after_seven_days_have_passed">Registration of this phone number will be possible without your Registration Lock PIN after 7 days have passed since this phone number was last active on Signal. You have %d days remaining.</string>
<string name="RegistrationActivity_registration_lock_pin">Registration lock PIN</string>
<string name="RegistrationActivity_this_phone_number_has_registration_lock_enabled_please_enter_the_registration_lock_pin">This phone number has Registration Lock enabled. Please enter the Registration Lock PIN.</string>
<string name="RegistrationLockDialog_registration_lock_is_enabled_for_your_phone_number">Registration Lock is enabled for your phone number.</string>
<string name="RegistrationLockDialog_i_forgot_my_pin">I forgot my PIN.</string>
<string name="RegistrationLockDialog_forgotten_pin">Forgotten PIN?</string>
<string name="RegistrationLockDialog_registration_lock_helps_protect_your_phone_number_from_unauthorized_registration_attempts">Registration Lock helps protect your phone number from unauthorized registration attempts. This feature can be disabled at any time in your Signal privacy settings</string>
<string name="RegistrationLockDialog_registration_lock">Registration Lock</string>
<string name="RegistrationLockDialog_enable">Enable</string>
<string name="RegistrationLockDialog_the_registration_lock_pin_must_be_at_least_four_digits">The Registration Lock PIN must be at least 4 digits.</string>
<string name="RegistrationLockDialog_the_two_pins_you_entered_do_not_match">The two PINs you entered do not match.</string>
<string name="RegistrationLockDialog_error_connecting_to_the_service">Error connecting to the service</string>
<string name="RegistrationLockDialog_disable_registration_lock_pin">Disable Registration Lock PIN?</string>
<string name="RegistrationLockDialog_disable">Disable</string>
<!-- EOF -->
</resources>

View File

@@ -67,4 +67,15 @@
android:title="@string/preferences_app_protection__blocked_contacts" />
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_divider"/>
<PreferenceCategory android:title="@string/preferences_app_protection__registration_lock">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_registration_lock"
android:title="@string/preferences_app_protection__registration_lock_pin"
android:summary="@string/preferences_app_protection__enable_a_registration_lock_pin_that_will_be_required"/>
</PreferenceCategory>
</PreferenceScreen>