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() {
SecureRandom random = new SecureRandom();
byte[] iv = new byte[16];
byte[] iv = new byte[12];
random.nextBytes(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.PendingItem;
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.Resolver;
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.setFocusable(editable);
this.binding.accountJid.setFocusableInTouchMode(editable);
this.binding.accountJid.setCursorVisible(editable);
final String displayName = mAccount.getDisplayName();
updateDisplayName(displayName);
if (mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) {
this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(true);
} else {
this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(false);
}
final boolean tooglePassword = mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
final boolean editPassword = !mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || (!mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isConversations());
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) {
this.binding.avater.setVisibility(View.VISIBLE);

View File

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

View File

@ -15,6 +15,7 @@
<attr name="color_background_tertiary" format="reference|color"/>
<attr name="color_background_secondary" 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="EmojiColor" format="reference|color"/>

View File

@ -13,6 +13,7 @@
<item name="color_warning">@color/red_a700</item>
<item name="TextColorOnline">@color/green600</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_no_results">@drawable/no_results_background_light</item>
@ -128,6 +129,7 @@
<item name="TextColorOnline">@color/green500</item>
<item name="TextColorError">@color/red500</item>
<item name="edit_text_color">@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.setOption(Account.OPTION_DISABLED, true);
account.setOption(Account.OPTION_MAGIC_CREATE, true);
account.setOption(Account.OPTION_UNVERIFIED, true);
service.createAccount(account);
}