show 'show password' toggle for all magically created accounts. make quicksy accounts magically created

This commit is contained in:
Daniel Gultsch 2018-11-20 21:33:43 +01:00
parent 4d0c037547
commit 03d5aa8aeb
6 changed files with 18 additions and 6 deletions

View file

@ -165,7 +165,7 @@ public class XmppAxolotlMessage {
private static byte[] generateIv() { private static byte[] generateIv() {
SecureRandom random = new SecureRandom(); SecureRandom random = new SecureRandom();
byte[] iv = new byte[16]; byte[] iv = new byte[12];
random.nextBytes(iv); random.nextBytes(iv);
return iv; return iv;
} }

View file

@ -60,6 +60,7 @@ import eu.siacs.conversations.ui.adapter.PresenceTemplateAdapter;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.Resolver;
import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.SignupUtils;
@ -893,17 +894,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.accountJid.setEnabled(editable); this.binding.accountJid.setEnabled(editable);
this.binding.accountJid.setFocusable(editable); this.binding.accountJid.setFocusable(editable);
this.binding.accountJid.setFocusableInTouchMode(editable); this.binding.accountJid.setFocusableInTouchMode(editable);
this.binding.accountJid.setCursorVisible(editable);
final String displayName = mAccount.getDisplayName(); final String displayName = mAccount.getDisplayName();
updateDisplayName(displayName); updateDisplayName(displayName);
if (mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) { final boolean tooglePassword = mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(true); final boolean editPassword = !mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || (!mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isConversations());
} else {
this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(false); this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(tooglePassword);
}
this.binding.accountPassword.setFocusable(editPassword);
this.binding.accountPassword.setFocusableInTouchMode(editPassword);
this.binding.accountPassword.setCursorVisible(editPassword);
this.binding.accountPassword.setEnabled(editPassword);
if (!mInitMode) { if (!mInitMode) {
this.binding.avater.setVisibility(View.VISIBLE); this.binding.avater.setVisibility(View.VISIBLE);

View file

@ -67,6 +67,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:textColor="?attr/edit_text_color"
style="@style/Widget.Conversations.EditText"/> style="@style/Widget.Conversations.EditText"/>
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
@ -88,6 +89,7 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:hint="@string/password" android:hint="@string/password"
android:inputType="textPassword" android:inputType="textPassword"
android:textColor="?attr/edit_text_color"
style="@style/Widget.Conversations.EditText"/> style="@style/Widget.Conversations.EditText"/>
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>

View file

@ -15,6 +15,7 @@
<attr name="color_background_tertiary" format="reference|color"/> <attr name="color_background_tertiary" format="reference|color"/>
<attr name="color_background_secondary" format="reference|color"/> <attr name="color_background_secondary" format="reference|color"/>
<attr name="color_background_primary" format="reference|color"/> <attr name="color_background_primary" format="reference|color"/>
<attr name="edit_text_color" format="reference|color"/>
<attr name="color_warning" format="reference|color"/> <attr name="color_warning" format="reference|color"/>
<attr name="EmojiColor" format="reference|color"/> <attr name="EmojiColor" format="reference|color"/>

View file

@ -13,6 +13,7 @@
<item name="color_warning">@color/red_a700</item> <item name="color_warning">@color/red_a700</item>
<item name="TextColorOnline">@color/green600</item> <item name="TextColorOnline">@color/green600</item>
<item name="TextColorError">@color/red800</item> <item name="TextColorError">@color/red800</item>
<item name="edit_text_color">@color/black87</item>
<item name="activity_background_search">@drawable/search_background_light</item> <item name="activity_background_search">@drawable/search_background_light</item>
<item name="activity_background_no_results">@drawable/no_results_background_light</item> <item name="activity_background_no_results">@drawable/no_results_background_light</item>
@ -128,6 +129,7 @@
<item name="TextColorOnline">@color/green500</item> <item name="TextColorOnline">@color/green500</item>
<item name="TextColorError">@color/red500</item> <item name="TextColorError">@color/red500</item>
<item name="edit_text_color">@color/white</item>
<item name="EmojiColor">@color/white</item> <item name="EmojiColor">@color/white</item>

View file

@ -169,6 +169,7 @@ public class QuickConversationsService extends AbstractQuickConversationsService
} }
account = new Account(jid, CryptoHelper.createPassword(new SecureRandom())); account = new Account(jid, CryptoHelper.createPassword(new SecureRandom()));
account.setOption(Account.OPTION_DISABLED, true); account.setOption(Account.OPTION_DISABLED, true);
account.setOption(Account.OPTION_MAGIC_CREATE, true);
account.setOption(Account.OPTION_UNVERIFIED, true); account.setOption(Account.OPTION_UNVERIFIED, true);
service.createAccount(account); service.createAccount(account);
} }