Skip to content

Commit a8511f1

Browse files
author
Tom James Holub
committed
Merge remote-tracking branch 'origin/0.4.1' into 0.4.1
2 parents 7684d3f + 084c221 commit a8511f1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/database/FlowCryptSQLiteOpenHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ private void upgradeDatabaseFrom3To4Version(SQLiteDatabase sqLiteDatabase) {
150150
sqLiteDatabase.beginTransaction();
151151
try {
152152
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
153-
" ADD COLUMN " + AccountDaoSource.COL_USERNAME + " TEXT NOT NULL DEFAULT 'user';");
153+
" ADD COLUMN " + AccountDaoSource.COL_USERNAME + " TEXT NOT NULL DEFAULT '';");
154154
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
155-
" ADD COLUMN " + AccountDaoSource.COL_PASSWORD + " TEXT NOT NULL DEFAULT 'password';");
155+
" ADD COLUMN " + AccountDaoSource.COL_PASSWORD + " TEXT NOT NULL DEFAULT '';");
156156
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
157-
" ADD COLUMN " + AccountDaoSource.COL_IMAP_SERVER + " TEXT NOT NULL DEFAULT 'example.com';");
157+
" ADD COLUMN " + AccountDaoSource.COL_IMAP_SERVER + " TEXT NOT NULL DEFAULT '';");
158158
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
159159
" ADD COLUMN " + AccountDaoSource.COL_IMAP_PORT + " INTEGER DEFAULT 143;");
160160
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
@@ -164,7 +164,7 @@ private void upgradeDatabaseFrom3To4Version(SQLiteDatabase sqLiteDatabase) {
164164
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
165165
" ADD COLUMN " + AccountDaoSource.COL_IMAP_AUTH_MECHANISMS + " TEXT;");
166166
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
167-
" ADD COLUMN " + AccountDaoSource.COL_SMTP_SERVER + " TEXT NOT NULL DEFAULT 'example.com';");
167+
" ADD COLUMN " + AccountDaoSource.COL_SMTP_SERVER + " TEXT NOT NULL DEFAULT '';");
168168
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +
169169
" ADD COLUMN " + AccountDaoSource.COL_SMTP_PORT + " INTEGER DEFAULT 25;");
170170
sqLiteDatabase.execSQL("ALTER TABLE " + AccountDaoSource.TABLE_NAME_ACCOUNTS +

FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/source/AccountDaoSource.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,17 @@ public static AuthCredentials getCurrentAuthCredentialsFromCursor(KeyStoreCrypto
162162
smtpSecurityTypeOption = SecurityType.Option.STARTLS;
163163
}
164164

165+
String originalPassword = cursor.getString(cursor.getColumnIndex(COL_PASSWORD));
166+
167+
//fixed a bug when try to decrypting the template password.
168+
// See https://github.com/FlowCrypt/flowcrypt-android/issues/168
169+
if (originalPassword.equalsIgnoreCase("password")) {
170+
originalPassword = "";
171+
}
172+
165173
return new AuthCredentials.Builder().setEmail(cursor.getString(cursor.getColumnIndex(COL_EMAIL)))
166174
.setUsername(cursor.getString(cursor.getColumnIndex(COL_USERNAME)))
167-
.setPassword(keyStoreCryptoManager.decryptWithRSA(
168-
cursor.getString(cursor.getColumnIndex(COL_PASSWORD))))
175+
.setPassword(keyStoreCryptoManager.decryptWithRSA(originalPassword))
169176
.setImapServer(cursor.getString(cursor.getColumnIndex(COL_IMAP_SERVER)))
170177
.setImapPort(cursor.getInt(cursor.getColumnIndex(COL_IMAP_PORT)))
171178
.setImapSecurityTypeOption(imapSecurityTypeOption)

0 commit comments

Comments
 (0)