aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-02-21 20:25:56 +0100
committerChristian Schneppe <christian@pix-art.de>2019-02-21 20:25:56 +0100
commit24a9c319aed4089eb97bedb249cd6ddbff13d398 (patch)
tree2b69c00c1a9172d26fe05928e40d247280630022 /src
parenta5019812fbdaf57096b8483778b610fd3b0d1887 (diff)
add password forgotten item to edit profile menu
fixes #295
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java29
-rw-r--r--src/main/res/menu/editaccount.xml3
-rw-r--r--src/main/res/values/defaults.xml25
-rw-r--r--src/main/res/values/strings.xml3
4 files changed, 60 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 9e4f15a36..d482b7326 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -660,6 +660,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
final MenuItem shareBarcode = menu.findItem(R.id.action_share_barcode);
final MenuItem shareQRCode = menu.findItem(R.id.action_show_qr_code);
final MenuItem announcePGP = menu.findItem(R.id.mgmt_account_announce_pgp);
+ final MenuItem forgotPassword = menu.findItem(R.id.mgmt_account_password_forgotten);
renewCertificate.setVisible(mAccount != null && mAccount.getPrivateKeyAlias() != null);
if (mAccount != null && mAccount.isOnlineAndConnected()) {
@@ -671,10 +672,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
reconnect.setVisible(true);
announcePGP.setVisible(true);
+ forgotPassword.setVisible(true);
mamPrefs.setVisible(mAccount.getXmppConnection().getFeatures().mam());
changePresence.setVisible(!mInitMode);
} else {
announcePGP.setVisible(false);
+ forgotPassword.setVisible(false);
reconnect.setVisible(false);
showBlocklist.setVisible(false);
showMoreInfo.setVisible(false);
@@ -885,10 +888,36 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
case R.id.mgmt_account_announce_pgp:
publishOpenPGPPublicKey(mAccount);
return true;
+ case R.id.mgmt_account_password_forgotten:
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.password_forgotten_title);
+ builder.setMessage(R.string.password_forgotten_text);
+ builder.setNegativeButton(R.string.cancel, null);
+ builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
+ try {
+ Uri uri = Uri.parse(getSupportSite(mAccount.getJid().getDomain()));
+ final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(intent);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ builder.create().show();
}
return super.onOptionsItemSelected(item);
}
+ private String getSupportSite(String domain) {
+ int i = -1;
+ for (String domains: getResources().getStringArray(R.array.support_domains)) {
+ i++;
+ if (domains.equals(domain)) {
+ return getResources().getStringArray(R.array.support_site)[i];
+ }
+ }
+ return domain;
+ }
+
private boolean inNeedOfSaslAccept() {
return mAccount != null && mAccount.getLastErrorStatus() == Account.State.DOWNGRADE_ATTACK && mAccount.getKeyAsInt(Account.PINNED_MECHANISM_KEY, -1) >= 0 && !accountInfoEdited();
}
diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml
index 59667c1c7..90356c266 100644
--- a/src/main/res/menu/editaccount.xml
+++ b/src/main/res/menu/editaccount.xml
@@ -72,6 +72,9 @@
android:title="@string/change_password"
app:showAsAction="ifRoom" />
<item
+ android:id="@+id/mgmt_account_password_forgotten"
+ android:title="@string/mgmt_account_password_forgotten" />
+ <item
android:id="@+id/mgmt_account_reconnect"
android:title="@string/mgmt_account_reconnect"
app:showAsAction="never" />
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index 512a60138..e8e0c9206 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -236,5 +236,30 @@
<item>blabber.im</item>
<item>buzon.uy</item>
</string-array>
+
+ <string-array name="support_domains">
+ <item>pix-art.de</item>
+ <item>blabber.im</item>
+ <item>jabber.de</item>
+ <item>dismail.de</item>
+ <item>draugr.de</item>
+ <item>conversations.im</item>
+ <item>jabber.at</item>
+ <item>jabber-germany.de</item>
+ <item>jabjab.de</item>
+ <item>jabber.fr</item>
+ </string-array>
+ <string-array name="support_site">
+ <item>https://jabber.pix-art.de/impressum/</item>
+ <item>https://blabber.im/en/kontakt/</item>
+ <item>https://www.jabber.de/support/</item>
+ <item>https://dismail.de/contact.html</item>
+ <item>https://www.draugr.de/kontakt/</item>
+ <item>https://conversations.im/#support</item>
+ <item>https://jabber.at/account/password/reset/</item>
+ <item>https://jabber-germany.de/impressum.html</item>
+ <item>https://jabjab.de/kontakt.php</item>
+ <item>https://jabberfr.org/contact/</item>
+ </string-array>
</resources>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index e8c2dd0b8..d4dd1c5cf 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -887,4 +887,7 @@
<string name="notification_backup_failed_subtitle">The backup files could not be stored in %s</string>
<string name="search_participants">Search participants</string>
<string name="file_too_large">File too large</string>
+ <string name="mgmt_account_password_forgotten">Password forgotten</string>
+ <string name="password_forgotten_title">Password forgotten</string>
+ <string name="password_forgotten_text">You have forgotten your account password? We will now try to open the support website of your provider.</string>
</resources>