summaryrefslogtreecommitdiff
path: root/app/src/main/res
diff options
context:
space:
mode:
authorJoel Beckmeyer <joel@thebeckmeyers.xyz>2018-09-25 13:45:54 -0400
committerحسين <zidhussein@gmail.com>2018-09-25 18:45:54 +0100
commiteea0e68dda1eb7248c6d458f52baeedb318b466a (patch)
tree73ff2b2f121b8db3097671f0e0639906edc2abea /app/src/main/res
parentac889abdd3d71ffb7f064a384c375ec22e7734c4 (diff)
Display HOTP code if password contains HOTP secret, unify HOTP and TOTP code (#413)
* Display HOTP code if password contains HOTP secret, unify HOTP and TOTP code * Add ability to show HOTP instead of showing every decrypt * Fix off by 1 error * fix return intent logic so that edits and HOTP increments are properly committed * fix linting errors * Fix broken logic for case when a password is created * add ability to choose if password entry will be updated on HOTP code calculation
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/layout/decrypt_layout.xml91
-rw-r--r--app/src/main/res/layout/otp_confirm_layout.xml21
-rw-r--r--app/src/main/res/values-ar/strings.xml4
-rw-r--r--app/src/main/res/values/strings.xml16
-rw-r--r--app/src/main/res/xml/preference.xml3
5 files changed, 84 insertions, 51 deletions
diff --git a/app/src/main/res/layout/decrypt_layout.xml b/app/src/main/res/layout/decrypt_layout.xml
index ac274e4e..d08e0dbf 100644
--- a/app/src/main/res/layout/decrypt_layout.xml
+++ b/app/src/main/res/layout/decrypt_layout.xml
@@ -3,15 +3,15 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.zeapo.pwdstore.crypto.PgpActivity"
+ android:background="@color/background"
android:orientation="vertical"
- android:background="@color/background">
+ tools:context="com.zeapo.pwdstore.crypto.PgpActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:padding="16dp"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
@@ -61,17 +61,17 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:src="@drawable/divider"
- android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
+ android:layout_marginTop="16dp"
+ android:src="@drawable/divider"
tools:ignore="ContentDescription" />
<LinearLayout
android:id="@+id/crypto_container_decrypt"
- android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
+ android:orientation="vertical"
android:visibility="invisible">
<GridLayout
@@ -83,39 +83,40 @@
android:id="@+id/crypto_password_show_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textStyle="bold"
- android:textColor="@android:color/black"
- android:text="@string/password"
+ android:layout_column="0"
android:layout_row="0"
- android:layout_column="0"/>
+ android:text="@string/password"
+ android:textColor="@android:color/black"
+ android:textStyle="bold" />
+
<TextView
android:id="@+id/crypto_password_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:typeface="monospace"
- android:textColor="@android:color/black"
android:layout_column="2"
- android:layout_row="0"/>
+ android:layout_row="0"
+ android:textColor="@android:color/black"
+ android:typeface="monospace" />
<ProgressBar
android:id="@+id/pbLoading"
+ style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="8dp"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_row="1"
android:layout_column="0"
- android:layout_columnSpan="3"/>
+ android:layout_columnSpan="3"
+ android:layout_marginBottom="8dp"
+ android:layout_marginTop="8dp"
+ android:layout_row="1" />
<Button
android:id="@+id/crypto_password_toggle_show"
android:layout_width="match_parent"
- android:text="@string/show_password"
android:layout_height="wrap_content"
- android:layout_row="2"
android:layout_column="0"
- android:layout_columnSpan="3"/>
+ android:layout_columnSpan="3"
+ android:layout_row="2"
+ android:text="@string/show_password" />
</GridLayout>
@@ -129,13 +130,13 @@
android:id="@+id/crypto_copy_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
- android:contentDescription="@string/copy_username"
- android:visibility="invisible"
android:background="@color/background"
- android:src="@drawable/ic_content_copy"/>
+ android:contentDescription="@string/copy_username"
+ android:src="@drawable/ic_content_copy"
+ android:visibility="invisible" />
<TextView
android:id="@+id/crypto_username_show_label"
@@ -146,10 +147,10 @@
android:layout_alignParentTop="true"
android:layout_toLeftOf="@id/crypto_copy_username"
android:layout_toStartOf="@id/crypto_copy_username"
- android:visibility="invisible"
android:text="@string/username"
android:textColor="@android:color/black"
- android:textStyle="bold" />
+ android:textStyle="bold"
+ android:visibility="invisible" />
<TextView
android:id="@+id/crypto_username_show"
@@ -160,45 +161,45 @@
android:layout_below="@id/crypto_username_show_label"
android:layout_toLeftOf="@id/crypto_copy_username"
android:layout_toStartOf="@id/crypto_copy_username"
- android:visibility="invisible"
android:textColor="@android:color/black"
android:textIsSelectable="true"
- android:typeface="monospace" />
+ android:typeface="monospace"
+ android:visibility="invisible" />
<ImageButton
- android:id="@+id/crypto_copy_totp"
+ android:id="@+id/crypto_copy_otp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
android:layout_below="@id/crypto_username_show"
- android:visibility="invisible"
- android:contentDescription="@string/copy_totp"
android:background="@color/background"
- android:src="@drawable/ic_content_copy"/>
+ android:contentDescription="@string/copy_otp"
+ android:src="@drawable/ic_content_copy"
+ android:visibility="invisible" />
<TextView
- android:id="@+id/crypto_totp_show_label"
+ android:id="@+id/crypto_otp_show_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:layout_toLeftOf="@id/crypto_copy_totp"
- android:layout_toStartOf="@id/crypto_copy_totp"
android:layout_below="@id/crypto_username_show"
- android:text="@string/totp"
+ android:layout_toLeftOf="@id/crypto_copy_otp"
+ android:layout_toStartOf="@id/crypto_copy_otp"
+ android:text="@string/otp"
android:textColor="@android:color/black"
android:textStyle="bold" />
<TextView
- android:id="@+id/crypto_totp_show"
+ android:id="@+id/crypto_otp_show"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:layout_below="@id/crypto_totp_show_label"
- android:layout_toLeftOf="@id/crypto_copy_totp"
- android:layout_toStartOf="@id/crypto_copy_totp"
+ android:layout_below="@id/crypto_otp_show_label"
+ android:layout_toLeftOf="@id/crypto_copy_otp"
+ android:layout_toStartOf="@id/crypto_copy_otp"
android:textColor="@android:color/black"
android:textIsSelectable="true"
android:typeface="monospace" />
@@ -209,7 +210,7 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:layout_below="@id/crypto_totp_show"
+ android:layout_below="@id/crypto_otp_show"
android:text="@string/extra_content"
android:textColor="@android:color/black"
android:textStyle="bold" />
@@ -230,4 +231,4 @@
</LinearLayout>
-</ScrollView> \ No newline at end of file
+</ScrollView>
diff --git a/app/src/main/res/layout/otp_confirm_layout.xml b/app/src/main/res/layout/otp_confirm_layout.xml
new file mode 100644
index 00000000..d2cb597e
--- /dev/null
+++ b/app/src/main/res/layout/otp_confirm_layout.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <CheckBox
+ android:id="@+id/hotp_remember_checkbox"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="8dp"
+ android:text="@string/dialog_update_check"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+</android.support.constraint.ConstraintLayout> \ No newline at end of file
diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml
index 4a41cbba..5b863e6d 100644
--- a/app/src/main/res/values-ar/strings.xml
+++ b/app/src/main/res/values-ar/strings.xml
@@ -65,11 +65,11 @@
<string name="password">كلمة السر :</string>
<string name="extra_content">بيانات إضافية :</string>
<string name="username">إسم المستخدم :</string>
- <string name="totp">TOTP :</string>
+ <string name="otp">OTP :</string>
<string name="edit_password">تعديل كلمة السر</string>
<string name="copy_password">نسخ كلمة السر</string>
<string name="copy_username">نسخ إسم المستخدم</string>
- <string name="copy_totp">نسخ رمز الـ OTP</string>
+ <string name="copy_otp">نسخ رمز الـ OTP</string>
<string name="share_as_plaintext">شارك كنص مجرد</string>
<string name="last_changed">آخِر تعديل %s</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2da5982a..247275a1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -23,14 +23,15 @@
<!-- git commits -->
<string name="add_commit_text">[ANDROID PwdStore] Add &#160;</string>
- <string name="edit_commit_text">[ANDROID PwdStore] Edit &#160;</string>
+ <string name="edit_commit_text">"[ANDROID PwdStore] Edit "</string>
+ <string name="increment_commit_text">"[ANDROID PwdStore] Increment HOTP counter for "</string>
<string name="from_store">&#160; from store.</string>
<!-- PGPHandler -->
<string name="provider_toast_text">No OpenPGP Provider selected!</string>
<string name="clipboard_password_toast_text">Password copied to clipboard, you have %d seconds to paste it somewhere.</string>
<string name="clipboard_username_toast_text">Username copied to clipboard</string>
- <string name="clipboard_totp_toast_text">TOTP code copied to clipboard</string>
+ <string name="clipboard_otp_toast_text">OTP code copied to clipboard</string>
<string name="file_toast_text">Please provide a file name</string>
<string name="empty_toast_text">You cannot use an empty password or empty extra content</string>
@@ -93,13 +94,18 @@
<string name="password">Password:</string>
<string name="extra_content">Extra content:</string>
<string name="username">Username:</string>
- <string name="totp">TOTP:</string>
+ <string name="otp">OTP:</string>
<string name="edit_password">Edit password</string>
<string name="copy_password">Copy password</string>
<string name="copy_username">Copy username</string>
- <string name="copy_totp">Copy OTP code</string>
+ <string name="copy_otp">Copy OTP code</string>
<string name="share_as_plaintext">Share as plaintext</string>
<string name="last_changed">Last changed %s</string>
+ <string name="dialog_update_title">Attention</string>
+ <string name="dialog_update_positive">Update entry</string>
+ <string name="dialog_update_negative">Leave unchanged</string>
+ <string name="dialog_update_body">The HOTP counter is about to be incremented. This change will be committed. If you press "Leave unchanged", the HOTP code will be shown, but the counter will not be changed.</string>
+ <string name="dialog_update_check">Remember my choice</string>
<!-- Preferences -->
<string name="pref_git_title">Git</string>
@@ -217,6 +223,7 @@
<string name="git_push_other_error">Remote rejected non-fast-forward push. Check receive.denyNonFastForwards variable in config file of destination repository.</string>
<string name="jgit_error_push_dialog_text">Error occurred during the push operation:</string>
<string name="ssh_key_clear_passphrase">Clear ssh-key saved passphrase</string>
+ <string name="hotp_remember_clear_choice">Clear saved preference for HOTP incrementing</string>
<string name="remember_the_passphrase">Remember the passphrase in the app configuration (insecure)</string>
<string name="hackish_tools">Hackish tools</string>
<string name="abort_rebase">Abort rebase</string>
@@ -224,4 +231,5 @@
<string name="crypto_password_edit_hint">p@ssw0rd!</string>
<string name="crypto_extra_edit_hint">username: something other extra content</string>
<string name="get_last_changed_failed">Failed to get last changed date</string>
+ <string name="hotp_pending">Tap copy to calculate HOTP</string>
</resources>
diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml
index e232c6e1..3e8f34a9 100644
--- a/app/src/main/res/xml/preference.xml
+++ b/app/src/main/res/xml/preference.xml
@@ -17,6 +17,9 @@
android:key="ssh_key_clear_passphrase"
android:title="@string/ssh_key_clear_passphrase" />
<Preference
+ android:key="hotp_remember_clear_choice"
+ android:title="@string/hotp_remember_clear_choice" />
+ <Preference
android:key="ssh_see_key"
android:title="@string/pref_ssh_see_key_title" />
<Preference