Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectId #2696

Open
wants to merge 110 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
6153242
Initial work on ConnectId UI and some intro logic. Working toward POC.
OrangeAndGreen Mar 2, 2023
466026c
Got rid of locked state for Connect ID (only logged out or logged in).
OrangeAndGreen Mar 10, 2023
06f9936
Renamed some files for consistency.
OrangeAndGreen Mar 30, 2023
6d7b527
Changes to initial ConnectID create/recovery workflow.
OrangeAndGreen Apr 6, 2023
87c6d0f
A few look-and-feel changes
OrangeAndGreen Apr 12, 2023
1bfa868
Merge remote-tracking branch 'origin/master' into dv/connect_id
OrangeAndGreen Apr 12, 2023
d16af33
Disabling ConnectID functionality by default.
OrangeAndGreen Apr 12, 2023
a60a863
Changed min SDK to 23.
OrangeAndGreen Apr 24, 2023
e2cb6cb
Added activity for getting Connect recovery vs. new account decision.
OrangeAndGreen Apr 27, 2023
f07b4ed
Fixed recently introduced crash after server error on Connect registr…
OrangeAndGreen Apr 28, 2023
5bd6747
Remembering registration phase to resume after app interruption.
OrangeAndGreen May 2, 2023
0cf3b66
Icons instead of highlighted text on two pages.
OrangeAndGreen May 3, 2023
52b1bb7
ConnectID V1 development, including several new activities.
OrangeAndGreen Jun 8, 2023
e5590c6
Added ConnectID unlock functionality as a developer option.
OrangeAndGreen Jun 9, 2023
db457b4
Improved ConnectID DB encryption using Android KeyStore.
OrangeAndGreen Jun 9, 2023
23881d8
Quick fix: Changed a key received from the server.
OrangeAndGreen Jun 9, 2023
303cac5
Fixed bug where password sometimes wouldn't auto-fill when it should.
OrangeAndGreen Jun 14, 2023
74a21d6
Merge remote-tracking branch 'origin/master' into dv/connect_id
OrangeAndGreen Jun 14, 2023
ab4e140
Added two new externalizable classes to list for FormStorageTest (fix…
OrangeAndGreen Jun 15, 2023
64ca2d2
Added one more externalizable class to FormStorageTest list.
OrangeAndGreen Jun 15, 2023
4db49b5
Added phone number checking to recovery decision page before allowing…
OrangeAndGreen Jun 19, 2023
a0ce2ea
Moved a bunch of ConnectID-related strings from android_translatable_…
OrangeAndGreen Jun 19, 2023
2c35dfb
Added some (temporary) error reporting to API call that checks if pho…
OrangeAndGreen Jun 20, 2023
78bcb6a
Styling improvements.
OrangeAndGreen Jun 21, 2023
88e094a
Solved DB passphrase encryption for API 21 and lower.
OrangeAndGreen Jun 23, 2023
1cca84f
Showing ConnectID page titles in blue bar at top of screen.
OrangeAndGreen Jun 27, 2023
3fc9f5a
Added AppSelectActivity initial implementation (not using yet).
OrangeAndGreen Jul 11, 2023
46aa87f
Show sign in/up if user is logged out
shubham1g5 Jul 11, 2023
8069967
don't set parent activity null on forget user as it causes crash when…
shubham1g5 Jul 11, 2023
a1c37f4
Merge branch 'master' into dv/connect_id
shubham1g5 Jul 11, 2023
371d2d2
Showing ConnectID sign-in menu option when user resumes registration …
OrangeAndGreen Jul 11, 2023
6d7d1b8
Merge branch 'dv/connect_id' of https://github.com/dimagi/commcare-an…
OrangeAndGreen Jul 23, 2023
57a8178
2-minute countdown between OTP requests.
OrangeAndGreen Jul 24, 2023
7a436c2
Disabling biometric config buttons when already configured.
OrangeAndGreen Jul 25, 2023
16521f2
BROKEN: Attempting to use getRecordsForValues to query app_data records.
OrangeAndGreen Jul 26, 2023
e0c18e8
Fixed bug using getRecordsForValues
OrangeAndGreen Jul 26, 2023
44ec36a
fix null check for buildProfileID
shubham1g5 Jul 26, 2023
a3c66aa
In progress: SSO functionality
OrangeAndGreen Jul 31, 2023
457ef9e
Changed UI and some workflow for biometrics configuration.
OrangeAndGreen Aug 1, 2023
ced400a
Logs connect signins
shubham1g5 Aug 2, 2023
993b8e9
set ccc_enabled as a user property
shubham1g5 Aug 2, 2023
68747e0
logs connect id account recovery attempts
shubham1g5 Aug 2, 2023
7774ea7
Logs ccc sign out and normal login clicks
shubham1g5 Aug 3, 2023
8803140
Merge pull request #2687 from dimagi/connectAnalytics
OrangeAndGreen Aug 3, 2023
ad3aa57
Changed SSO token retrieval to a sync process, and calling it asynchr…
OrangeAndGreen Aug 3, 2023
154a5be
Merge branch 'dv/connect_id' of https://github.com/dimagi/commcare-an…
OrangeAndGreen Aug 3, 2023
682f3ee
Completed initial SSO workflow.
OrangeAndGreen Aug 3, 2023
138f746
make event params unique
shubham1g5 Aug 8, 2023
dfd8fdc
More attempted fixes for earlier Android versions using PIN for biome…
OrangeAndGreen Aug 8, 2023
9a46ac9
Addressed several comments from PR 2660.
OrangeAndGreen Aug 9, 2023
6345b66
Merge pull request #2688 from dimagi/analyticsUniqueParams
shubham1g5 Aug 10, 2023
566078e
Showing a toast when user presses Continue button twice while network…
OrangeAndGreen Aug 11, 2023
f80e233
Merge branch 'dv/connect_id' of https://github.com/dimagi/commcare-an…
OrangeAndGreen Aug 11, 2023
f57970a
Changes to address PR comments.
OrangeAndGreen Aug 14, 2023
6ffa2f6
Refactored encryption methods slightly for easier testing.
OrangeAndGreen Aug 15, 2023
63f234d
Added unit test for encryption/decryption using RSA key pair.
OrangeAndGreen Aug 15, 2023
c718bf7
Applied CommCare coding style to all new ConnectID code.
OrangeAndGreen Aug 15, 2023
d4bf1b7
Better singleton loading for ConnectIDNetworkHelper.
OrangeAndGreen Aug 16, 2023
525b332
Addressing comments for PR.
OrangeAndGreen Aug 21, 2023
d88d97d
Tying transformation string to existing key in Keystore (so app can s…
OrangeAndGreen Aug 21, 2023
de32648
Showing progress dialogs for ConnectID network calls.
OrangeAndGreen Aug 21, 2023
3ca59c3
Added some missing strings (from conflict).
OrangeAndGreen Aug 22, 2023
0661af5
Merge branch 'master' into dv/connect_id
OrangeAndGreen Aug 22, 2023
bf11aa2
Removed extra API check and suppressed code warning.
OrangeAndGreen Aug 23, 2023
c4eb7bf
Merge branch 'dv/connect_id' of https://github.com/dimagi/commcare-an…
OrangeAndGreen Aug 23, 2023
f8724f0
Reverted KeyAndTransform from record back to simple helper class (cau…
OrangeAndGreen Aug 23, 2023
be096bb
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
OrangeAndGreen Aug 23, 2023
28c4610
Refactored encryption key code into EncryptionKeyProvider class and e…
OrangeAndGreen Aug 23, 2023
b3aa48e
Assigning default encryptionKeyProvider immediately (child can overri…
OrangeAndGreen Aug 23, 2023
5f53442
Creating MockEncryptionKeyProvider after super.onCreate for CommCareT…
OrangeAndGreen Aug 23, 2023
4bb727e
Addressing lint warnings.
OrangeAndGreen Aug 23, 2023
ee16434
Addressing more lint warnings, mostly code formatting and adding Java…
OrangeAndGreen Aug 23, 2023
f548a4a
Added javadoc descriptions
OrangeAndGreen Aug 23, 2023
b5b60e7
Broke some long lines into multiple
OrangeAndGreen Aug 23, 2023
d6719e3
Addressing remaining lint warnings in ConnectIDManager.
OrangeAndGreen Aug 24, 2023
8855e6b
Cleaning up more lint warnings.
OrangeAndGreen Aug 24, 2023
6409159
Addressing more lint warnings.
OrangeAndGreen Aug 24, 2023
b8d8997
Renamed all ConnectID* classes to ConnectId*
OrangeAndGreen Aug 24, 2023
98c0a6f
Fixed more lint warnings.
OrangeAndGreen Aug 24, 2023
cdea42d
Merge pull request #2660 from dimagi/dv/connect_id
OrangeAndGreen Aug 24, 2023
86494a7
Cleaned up lint warnings.
OrangeAndGreen Aug 24, 2023
03ba96a
Merge branch 'master' into feature/connect
shubham1g5 Sep 19, 2023
35bb746
Merge branch 'master' into feature/connect
shubham1g5 Sep 20, 2023
2ee6986
Merge branch 'master' into feature/connect
shubham1g5 Sep 20, 2023
febffc3
Merge branch 'master' into feature/connect
shubham1g5 Sep 24, 2023
17db442
missed some merge conflicts
shubham1g5 Sep 24, 2023
05a1f0b
Phone input: separated '+' out of country code input, restricting inp…
OrangeAndGreen Sep 26, 2023
f4d369d
Added check for API version when user tries to configure biometric. I…
OrangeAndGreen Sep 26, 2023
489c14a
Code formatting
OrangeAndGreen Sep 26, 2023
6ef9fe3
Updated URL for reset_password API call.
OrangeAndGreen Sep 26, 2023
bc5ac7e
Merge pull request #2711 from dimagi/dv/biometric_enroll
OrangeAndGreen Sep 26, 2023
2eb3177
Rearranged UI for biometric configuration to save vertical space for …
OrangeAndGreen Sep 27, 2023
ad41664
Merge pull request #2713 from dimagi/dv/bio_enroll_shrink
OrangeAndGreen Sep 27, 2023
dbec6f2
Added a check on logged in user when using CurrentAuth (possible fix …
OrangeAndGreen Sep 27, 2023
9d6c802
Fixed error populating phone number input with existing phone number.
OrangeAndGreen Sep 28, 2023
4f85b89
Not showing "Other options" button in fingerprint unlock dialog durin…
OrangeAndGreen Sep 28, 2023
8745a99
Merge pull request #2714 from dimagi/dv/phone_number_fix
OrangeAndGreen Sep 28, 2023
e1a4462
Merge pull request #2715 from dimagi/dv/fingerprint_options
OrangeAndGreen Sep 28, 2023
fcddc2b
Made biometric configuration page scrollable
OrangeAndGreen Oct 3, 2023
68b6172
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
OrangeAndGreen Mar 18, 2024
fa2508a
Removed extra comma from last commit.
OrangeAndGreen Mar 18, 2024
62bea48
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
OrangeAndGreen May 21, 2024
54458a6
Update gradle.properties
OrangeAndGreen May 22, 2024
be5a5e4
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
OrangeAndGreen Aug 26, 2024
a6862b2
Moved some files to match updated structure in Connect branch
OrangeAndGreen Aug 26, 2024
d4961df
Getting the ConnectID branch caught up with updates that happened on …
OrangeAndGreen Aug 27, 2024
261452f
Removed an unused line (for Connect), made a field final
OrangeAndGreen Aug 28, 2024
5111525
More moving code around to catchup to Connect branch development.
OrangeAndGreen Aug 29, 2024
f3ff08d
Merge pull request #2831 from dimagi/dv/connectid_catchup
OrangeAndGreen Sep 4, 2024
d81a045
Getting rid of some Connect code that made it through when updating b…
OrangeAndGreen Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Styling improvements.
Added code for encrypting DB in Android version before API 23.
Fixed going to alt. phone verification after password fails three times.
Added better consent wording, links, and checkbox.
OrangeAndGreen committed Jun 21, 2023
commit 78bcb6a3f8d3e4aa447be944c7fe62988eebc4b9
24 changes: 21 additions & 3 deletions app/res/layout/screen_connect_consent.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_consent_title"
@@ -16,13 +18,29 @@
android:text="@string/connect_consent_title"/>

<TextView
android:id="@+id/connect_consent_message"
android:id="@+id/connect_consent_message_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_min_margin"
android:gravity="start"
android:textSize="@dimen/text_medium"
android:text="@string/connect_consent_message"/>
android:text="@string/connect_consent_message_1" />

<TextView
android:id="@+id/connect_consent_message_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_min_margin"
android:gravity="start"
android:textSize="@dimen/text_medium"
android:text="@string/connect_consent_message_2" />

<CheckBox
android:id="@+id/connect_consent_check"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_consent_check"
/>

<Button
android:id="@+id/connect_consent_button"
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_login.xml
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_login_title"
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_message.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_message_title"
10 changes: 6 additions & 4 deletions app/res/layout/screen_connect_password.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_password_title"
@@ -13,7 +15,7 @@
android:layout_margin="@dimen/content_min_margin"
android:textColor="@color/cc_neutral_color"
android:textSize="@dimen/text_largest"
android:text="@string/connect_password_title"/>
android:text="@string/connect_password_title" />

<TextView
android:id="@+id/connect_password_message"
@@ -29,14 +31,14 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:text="@string/connect_password"/>
android:hint="@string/connect_password"/>

<AutoCompleteTextView
android:id="@+id/connect_password_repeat_input"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:text="@string/connect_password_repeat"/>
android:hint="@string/connect_password_repeat"/>

<TextView
android:id="@+id/connect_password_error_message"
8 changes: 5 additions & 3 deletions app/res/layout/screen_connect_password_verify.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_password_verify_title"
@@ -12,7 +14,7 @@
android:layout_gravity="center"
android:layout_margin="@dimen/content_min_margin"
android:textColor="@color/cc_neutral_color"
android:textSize="@dimen/text_largest"
android:textSize="@dimen/text_larger"
android:text="@string/connect_password_verify_title"/>

<TextView
@@ -29,7 +31,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:text="@string/connect_password_verify"/>
android:hint="@string/connect_password_verify"/>

<TextView
android:id="@+id/connect_password_verify_forgot"
6 changes: 4 additions & 2 deletions app/res/layout/screen_connect_phone_verify.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_phone_verify_title"
@@ -12,7 +14,7 @@
android:layout_gravity="center"
android:layout_margin="@dimen/content_min_margin"
android:textColor="@color/cc_neutral_color"
android:textSize="@dimen/text_largest"
android:textSize="@dimen/text_larger"
android:text="@string/connect_verify_phone_title"/>

<TextView
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_pictures.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_pictures_title"
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_primary_phone.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_primary_phone_title"
10 changes: 6 additions & 4 deletions app/res/layout/screen_connect_recovery_decision.xml
Original file line number Diff line number Diff line change
@@ -3,13 +3,15 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_recovery_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="start"
android:layout_margin="@dimen/content_min_margin"
android:textColor="@color/cc_neutral_color"
android:textSize="@dimen/text_largest"
@@ -57,7 +59,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/content_start"
android:paddingTop="@dimen/content_start"/>
android:paddingTop="@dimen/content_start" />

<TextView
android:id="@+id/connect_recovery_or"
@@ -73,6 +75,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/content_start"
android:paddingTop="@dimen/content_start" />
android:paddingTop="@dimen/content_start"/>

</LinearLayout>
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_registration.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_register_title"
4 changes: 3 additions & 1 deletion app/res/layout/screen_connect_verify.xml
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/cc_core_bg"
android:orientation="vertical">
android:orientation="vertical"
android:layout_marginStart="@dimen/content_start"
android:layout_marginEnd="@dimen/content_start">

<TextView
android:id="@+id/connect_verify_title"
25 changes: 14 additions & 11 deletions app/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -459,13 +459,15 @@
<string name="login_welcome_connect_signed_out" cc:translatable="true">Log into ConnectID first and then enter your app.</string>
<string name="login_welcome_connect_signed_in" cc:translatable="true">Welcome %s!</string>

<string name="choice_or" cc:translatable="true">------------- OR -------------</string>
<string name="choice_or" cc:translatable="true">_____________ Or _____________</string>

<string name="connect_button_logged_in" cc:translatable="true">Go to Connect menu</string>
<string name="connect_button_logged_out" cc:translatable="true">Login to Connect ID</string>

<string name="connect_consent_title" cc:translatable="true">Consent</string>
<string name="connect_consent_message" cc:translatable="true">Do you give your consent for ConnectID?</string>
<string name="connect_consent_message_1" cc:translatable="true">I have read and agree to Dimagi\'s <a href="https://www.dimagi.com/terms/latest/privacy/">Privacy Policy</a>, <a href="https://www.dimagi.com/terms/latest/tos/">Terms of Service</a>, <a href="https://www.dimagi.com/terms/latest/ba/">Business Agreement</a> and <a href="https://www.dimagi.com/terms/latest/aup/">Acceptable Use Policy</a>.</string>
<string name="connect_consent_message_2" cc:translatable="true">I acknowledge and understand that I may receive push notifications and SMS messages for the purpose of communication</string>
<string name="connect_consent_check" cc:translatable="true">Click here to give consent</string>
<string name="connect_consent_button" cc:translatable="true">OK</string>

<string name="connect_phone_title" cc:translatable="true">Primary Phone</string>
@@ -477,29 +479,30 @@
<string name="connect_phone_invalid" cc:translatable="true">Enter a valid phone number</string>
<string name="connect_phone_not_found" cc:translatable="true">Phone number not found</string>

<string name="connect_password_title" cc:translatable="true">Recovery Password</string>
<string name="connect_password_title" cc:translatable="true">Choose Password</string>
<string name="connect_password_message" cc:translatable="true">Please choose a recovery password</string>
<string name="connect_password_button" cc:translatable="true">OK</string>
<string name="connect_password" cc:translatable="true">Enter Password</string>
<string name="connect_password_repeat" cc:translatable="true">Confirm Password</string>
<string name="connect_password_mismatch" cc:translatable="true">Passwords must match</string>
<string name="connect_password_weak" cc:translatable="true">Please choose a stronger password</string>

<string name="connect_password_verify_title" cc:translatable="true">Recovery Password</string>
<string name="connect_password_verify_title" cc:translatable="true">Enter Your Password</string>
<string name="connect_password_verify_message" cc:translatable="true">Please enter your recovery password to continue.</string>
<string name="connect_password_verify" cc:translatable="true">Enter Password</string>
<string name="connect_password_verify_forgot" cc:translatable="true">I forgot my password</string>
<string name="connect_password_verify_forgot" cc:translatable="true">Forget your password?</string>
<string name="connect_password_verify_button" cc:translatable="true">Submit</string>

<string name="connect_password_fail_title" cc:translatable="true">Wrong Password</string>
<string name="connect_password_fail_message" cc:translatable="true">You entered the wrong password, please try again.</string>
<string name="connect_password_recovery_message" cc:translatable="true">You entered the wrong password too many times, you will need to recover your account.</string>
<string name="connect_password_fail_button" cc:translatable="true">OK</string>

<string name="connect_recovery_title" cc:translatable="true">ConnectID Account</string>
<string name="connect_recovery_decision_new" cc:translatable="true">This is the first time logging into Connect on this device. Do you need to create a new account or recover an existing account?</string>
<string name="connect_recovery_button_new" cc:translatable="true">Create New Account</string>
<string name="connect_recovery_decision_new" cc:translatable="true">Choose a step below</string>
<string name="connect_recovery_button_new" cc:translatable="true">Create New ConnectID Account</string>
<string name="connect_recovery_button_recover" cc:translatable="true">Recover Existing Account</string>
<string name="connect_recovery_decision_phone" cc:translatable="true">Please enter the primary phone number you registered with your account.</string>
<string name="connect_recovery_decision_phone" cc:translatable="true">Please enter the primary phone number you entered with your account</string>
<string name="connect_recovery_button_phone" cc:translatable="true">Continue</string>
<string name="connect_recovery_button_extended" cc:translatable="true">More Options</string>

@@ -541,10 +544,10 @@
<string name="connect_verify_button_configured" cc:translatable="true">Continue</string>
<string name="connect_verify_button_password" cc:translatable="true">Use Password Only</string>

<string name="connect_verify_phone_title" cc:translatable="true">Verify Phone</string>
<string name="connect_verify_phone_label" cc:translatable="true">Please enter the code sent via SMS to your primary phone%s.</string>
<string name="connect_verify_phone_title" cc:translatable="true">Enter verification code</string>
<string name="connect_verify_phone_label" cc:translatable="true">We sent you a code on number %s.</string>
<string name="connect_verify_phone_label_alternate" cc:translatable="true">Almost there! Please enter the code sent via SMS to your alternate phone%s.</string>
<string name="connect_verify_phone_resend" cc:translatable="true">Resend code</string>
<string name="connect_verify_phone_resend" cc:translatable="true">Didn\'t receive your code? Resend</string>
<string name="connect_verify_phone_change" cc:translatable="true">Change phone number</string>
<string name="connect_verify_phone_verify" cc:translatable="true">Verify code</string>

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.commcare.activities.connect;

import android.text.method.LinkMovementMethod;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

import org.commcare.dalvik.R;
import org.commcare.interfaces.CommCareActivityUIController;
@@ -9,6 +12,11 @@

@ManagedUi(R.layout.screen_connect_consent)
public class ConnectIDConsentActivityUIController implements CommCareActivityUIController {

@UiElement(value=R.id.connect_consent_message_1)
private TextView messageText;
@UiElement(value=R.id.connect_consent_check)
private CheckBox checkbox;
@UiElement(value = R.id.connect_consent_button)
private Button button;

@@ -20,11 +28,22 @@ public ConnectIDConsentActivityUIController(ConnectIDConsentActivity activity) {

@Override
public void setupUI() {
//This makes the links work in the consent message
messageText.setMovementMethod(LinkMovementMethod.getInstance());

checkbox.setOnClickListener(v -> updateState());

button.setOnClickListener(v -> activity.handleButtonPress());

updateState();
}

@Override
public void refreshView() {
updateState();
}

public void updateState() {
button.setEnabled(checkbox.isChecked());
}
}
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ public ConnectIDPasswordActivityUIController(ConnectIDPasswordActivity activity)
public void setupUI() {
button.setOnClickListener(v -> activity.handleButtonPress());

clearPasswordFields();

TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@@ -63,6 +65,10 @@ public void requestInputFocus() {
KeyboardHelper.showKeyboardOnInput(activity, passwordInput);
}

public void clearPasswordFields() {
passwordInput.setText("");
passwordRepeatInput.setText("");
}
public String getPasswordText() {
return passwordInput.getText().toString();
}
Original file line number Diff line number Diff line change
@@ -20,11 +20,16 @@

public class ConnectIDPasswordVerificationActivity extends CommCareActivity<ConnectIDPasswordVerificationActivity>
implements WithUIController {
public static final int PASSWORD_FAIL = 1;
public static final int PASSWORD_LOCK = 2;
private ConnectIDPasswordVerificationActivityUIController uiController;

private String phone = null;
private String secretKey = null;

private static final int MaxFailures = 3;
private int failureCount = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -33,6 +38,8 @@ protected void onCreate(Bundle savedInstanceState) {
secretKey = getIntent().getStringExtra(ConnectIDConstants.SECRET);

uiController.setupUI();

failureCount = 0;
}

@Override
@@ -48,6 +55,15 @@ public void onResume() {
@Override
public void initUIController() { uiController = new ConnectIDPasswordVerificationActivityUIController(this); }

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);

if(requestCode == PASSWORD_LOCK) {
finish(true, true, null, null, null);
}
}

public void finish(boolean success, boolean forgot, String username, String name, String password) {
Intent intent = new Intent(getIntent());

@@ -60,13 +76,24 @@ public void finish(boolean success, boolean forgot, String username, String name
finish();
}

public void showWrongPasswordDialog() {
public void handleWrongPassword() {
failureCount++;
uiController.clearPassword();

int requestCode = PASSWORD_FAIL;
String message = getString(R.string.connect_password_fail_message);

if(failureCount >= MaxFailures) {
requestCode = PASSWORD_LOCK;
message = getString(R.string.connect_password_recovery_message);
}

Intent messageIntent = new Intent(this, ConnectIDMessageActivity.class);
messageIntent.putExtra(ConnectIDConstants.TITLE, getString(R.string.connect_password_fail_title));
messageIntent.putExtra(ConnectIDConstants.MESSAGE, getString(R.string.connect_password_fail_message));
messageIntent.putExtra(ConnectIDConstants.MESSAGE, message);
messageIntent.putExtra(ConnectIDConstants.BUTTON, getString(R.string.connect_password_fail_button));

startActivityForResult(messageIntent, 1);
startActivityForResult(messageIntent, requestCode);
}

public void handleForgotPress() {
@@ -82,7 +109,7 @@ public void handleButtonPress() {
finish(true, false, null, null, null);
}
else {
showWrongPasswordDialog();
handleWrongPassword();
}
}
else {
@@ -121,7 +148,7 @@ public void processSuccess(int responseCode, InputStream responseData) {

@Override
public void processFailure(int responseCode, IOException e) {
showWrongPasswordDialog();
handleWrongPassword();
}
});
}
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ public ConnectIDPasswordVerificationActivityUIController(ConnectIDPasswordVerifi
public void setupUI() {
forgotLink.setOnClickListener(arg0 -> activity.handleForgotPress());
button.setOnClickListener(arg0 -> activity.handleButtonPress());

clearPassword();
}

@Override
@@ -40,6 +42,8 @@ public String getPassword() {
return passwordInput.getText().toString();
}

public void clearPassword() { passwordInput.setText(""); }

public void requestInputFocus() {
KeyboardHelper.showKeyboardOnInput(activity, passwordInput);
}
Original file line number Diff line number Diff line change
@@ -14,9 +14,11 @@
import org.commcare.interfaces.CommCareActivityUIController;
import org.commcare.interfaces.WithUIController;
import org.commcare.utils.PhoneNumberHelper;
import org.javarosa.core.services.Logger;

import java.io.IOException;
import java.io.InputStream;
import java.security.cert.CertPathValidatorException;
import java.util.HashMap;
import java.util.Locale;

@@ -128,10 +130,14 @@ public void processSuccess(int responseCode, InputStream responseData) {

@Override
public void processFailure(int responseCode, IOException e) {
uiController.setAvailabilityText(getString(R.string.connect_phone_unavailable));
String text = getString(R.string.connect_phone_unavailable);
uiController.setOkButtonEnabled(false);

Toast.makeText(context, String.format("Error code %d when testing number '%s'", responseCode, phoneLock), Toast.LENGTH_LONG).show();
if(e != null) {
Logger.exception("Checking phone number", e);
}

uiController.setAvailabilityText(text);
}
});
}
Original file line number Diff line number Diff line change
@@ -69,19 +69,12 @@ public void onResume() {

public void updateMessage() {
boolean alternate = method == MethodRecoveryAlternate;
int labelId = alternate ?
R.string.connect_verify_phone_label_alternate :
R.string.connect_verify_phone_label;

String phone = alternate ? recoveryPhone : primaryPhone;
if(phone != null) {
phone = " (" + phone + ")";
}
else {
phone = "";
if(phone == null) {
phone = "-";
}

uiController.setLabelText(getString(labelId, phone));
uiController.setLabelText(getString(R.string.connect_verify_phone_label, phone));
}

public void requestSMSCode() {
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ public void handleButton2Press() {
uiController.requestInputFocus();
uiController.setMessage(getString(R.string.connect_recovery_decision_phone));
uiController.setButton1Text(getString(R.string.connect_recovery_button_phone));
uiController.setButton2Text(getString(R.string.connect_recovery_button_extended));
uiController.setButton2Visible(false);
}
case PhoneOrExtended -> {
Toast.makeText(this, "Not ready yet!", Toast.LENGTH_SHORT).show();
Original file line number Diff line number Diff line change
@@ -33,6 +33,9 @@ public class ConnectIDRecoveryDecisionActivityUIController implements CommCareAc
@UiElement(value = R.id.connect_recovery_button_1)
private Button button1;

@UiElement(value = R.id.connect_recovery_or)
private TextView orText;

@UiElement(value = R.id.connect_recovery_button_2)
private Button button2;

@@ -107,5 +110,6 @@ public void setButton2Text(String text) {

public void setButton2Visible(boolean visible) {
button2.setVisibility(visible ? View.VISIBLE : View.GONE);
orText.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
9 changes: 7 additions & 2 deletions app/src/org/commcare/utils/EncryptionUtils.java
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ private static SecretKey getKey()
}

//Create key
SecretKey secretKey;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder(SECRET_NAME,
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT);
@@ -73,10 +74,14 @@ private static SecretKey getKey()

KeyGenerator generator = KeyGenerator.getInstance(ALGORITHM);
generator.init(builder.build());
return generator.generateKey();
secretKey = generator.generateKey();
} else {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
secretKey = keyGen.generateKey();
}

return null;
return secretKey;
}

//Generate a random passphrase