diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000..1c36519f5e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1 @@ +/dictionaries/ivan.xml diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountActivityEnterpriseTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountActivityEnterpriseTest.kt index 4dbb51322d..500bab4004 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountActivityEnterpriseTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountActivityEnterpriseTest.kt @@ -81,13 +81,12 @@ class AddNewAccountActivityEnterpriseTest : BaseSignActivityTest() { val mockWebServerRule = FlowCryptMockWebServerRule(TestConstants.MOCK_WEB_SERVER_PORT, object : Dispatcher() { override fun dispatch(request: RecordedRequest): MockResponse { val gson = ApiHelper.getInstance(InstrumentationRegistry.getInstrumentation().targetContext).gson - val model = gson.fromJson(InputStreamReader(request.body.inputStream()), - LoginModel::class.java) + val model = gson.fromJson(InputStreamReader(request.body.inputStream()), LoginModel::class.java) if (request.path.equals("/account/login")) { when (model.account) { EMAIL_WITH_NO_PRV_CREATE_RULE -> return MockResponse().setResponseCode(200) - .setBody(gson.toJson(LoginResponse(null, isRegistered = true, isVerified = true))) + .setBody(gson.toJson(LoginResponse(null, isVerified = true))) } } diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/SignInActivityEnterpriseTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/SignInActivityEnterpriseTest.kt index 7c72c63ef9..4d708af1c1 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/SignInActivityEnterpriseTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/SignInActivityEnterpriseTest.kt @@ -85,13 +85,6 @@ class SignInActivityEnterpriseTest : BaseSignActivityTest() { isToastDisplayed(decorView, getResString(R.string.user_not_verified)) } - @Test - @ReadyForCIAnnotation - fun testSuccessLoginNotRegisteredNotVerified() { - setupAndClickSignInButton(genMockGoogleSignInAccountJson(EMAIL_LOGIN_NOT_REGISTERED_NOT_VERIFIED)) - isToastDisplayed(decorView, getResString(R.string.user_not_registered_not_verified)) - } - @Test @ReadyForCIAnnotation fun testErrorGetDomainRules() { @@ -113,11 +106,10 @@ class SignInActivityEnterpriseTest : BaseSignActivityTest() { const val EMAIL_WITH_NO_PRV_CREATE_RULE = "no_prv_create@example.com" const val EMAIL_LOGIN_ERROR = "login_error@example.com" const val EMAIL_LOGIN_NOT_VERIFIED = "login_not_verified@example.com" - const val EMAIL_LOGIN_NOT_REGISTERED_NOT_VERIFIED = "login_not_registered_not_verified@example.com" const val EMAIL_DOMAIN_RULES_ERROR = "domain_rules_error@example.com" val LOGIN_API_ERROR_RESPONSE = LoginResponse(ApiError(400, "Something wrong happened.", - "api input: missing key: token"), null, null) + "api input: missing key: token"), null) val DOMAIN_RULES_ERROR_RESPONSE = DomainRulesResponse(ApiError(401, "Not logged in or unknown account", "auth"), null) @@ -134,17 +126,14 @@ class SignInActivityEnterpriseTest : BaseSignActivityTest() { EMAIL_LOGIN_ERROR -> return MockResponse().setResponseCode(200) .setBody(gson.toJson(LOGIN_API_ERROR_RESPONSE)) - EMAIL_LOGIN_NOT_REGISTERED_NOT_VERIFIED -> return MockResponse().setResponseCode(200) - .setBody(gson.toJson(LoginResponse(null, isRegistered = false, isVerified = false))) - EMAIL_LOGIN_NOT_VERIFIED -> return MockResponse().setResponseCode(200) - .setBody(gson.toJson(LoginResponse(null, isRegistered = true, isVerified = false))) + .setBody(gson.toJson(LoginResponse(null, isVerified = false))) EMAIL_DOMAIN_RULES_ERROR -> return MockResponse().setResponseCode(200) - .setBody(gson.toJson(LoginResponse(null, isRegistered = true, isVerified = true))) + .setBody(gson.toJson(LoginResponse(null, isVerified = true))) EMAIL_WITH_NO_PRV_CREATE_RULE -> return MockResponse().setResponseCode(200) - .setBody(gson.toJson(LoginResponse(null, isRegistered = true, isVerified = true))) + .setBody(gson.toJson(LoginResponse(null, isVerified = true))) } } @@ -163,4 +152,4 @@ class SignInActivityEnterpriseTest : BaseSignActivityTest() { } }) } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/response/api/LoginResponse.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/response/api/LoginResponse.kt index c7810c74f1..b96d3197c6 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/response/api/LoginResponse.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/response/api/LoginResponse.kt @@ -1,6 +1,8 @@ /* * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com - * Contributors: DenBond7 + * Contributors: + * DenBond7 + * Ivan Pizhenko */ package com.flowcrypt.email.api.retrofit.response.api @@ -22,19 +24,15 @@ import com.google.gson.annotations.SerializedName */ data class LoginResponse constructor(@SerializedName("error") @Expose override val apiError: ApiError?, - @SerializedName("registered") - @Expose val isRegistered: Boolean?, @SerializedName("verified") @Expose val isVerified: Boolean?) : ApiResponse { constructor(parcel: Parcel) : this( parcel.readParcelable(ApiError::class.java.classLoader), - parcel.readValue(Boolean::class.java.classLoader) as Boolean?, parcel.readValue(Boolean::class.java.classLoader) as Boolean?) override fun writeToParcel(parcel: Parcel, flags: Int) { with(parcel) { writeParcelable(apiError, flags) - writeValue(isRegistered) writeValue(isVerified) } } @@ -52,4 +50,4 @@ data class LoginResponse constructor(@SerializedName("error") return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/EnterpriseDomainRulesViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/EnterpriseDomainRulesViewModel.kt index d6a89d4406..c5f8d149d7 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/EnterpriseDomainRulesViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/EnterpriseDomainRulesViewModel.kt @@ -1,6 +1,8 @@ /* * © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com - * Contributors: DenBond7 + * Contributors: + * DenBond7 + * Ivan Pizhenko */ package com.flowcrypt.email.jetpack.viewmodel @@ -49,18 +51,13 @@ class EnterpriseDomainRulesViewModel(application: Application) : BaseAndroidView } Result.Status.SUCCESS -> { - if (loginResult.data?.isRegistered == true && loginResult.data.isVerified == true) { + if (loginResult.data?.isVerified == true) { val domainRulesResult = repository.getDomainRules(context, DomainRulesRequest(ApiName.POST_GET_DOMAIN_RULES, LoginModel(account, uuid))) domainRulesLiveData.value = domainRulesResult - } else when { - loginResult.data?.isRegistered == false && loginResult.data.isVerified == false -> - domainRulesLiveData.value = Result.error(LoginResponse(ApiError(-1, - context.getString(R.string.user_not_registered_not_verified)), false, false)) - - loginResult.data?.isVerified == false -> - domainRulesLiveData.value = Result.error(LoginResponse(ApiError(-1, - context.getString(R.string.user_not_verified)), true, false)) + } else { + domainRulesLiveData.value = Result.error(LoginResponse(ApiError(-1, + context.getString(R.string.user_not_verified)), false)) } } @@ -70,4 +67,4 @@ class EnterpriseDomainRulesViewModel(application: Application) : BaseAndroidView } } } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/res/values/strings.xml b/FlowCrypt/src/main/res/values/strings.xml index cf742548c4..dce7ca18f0 100644 --- a/FlowCrypt/src/main/res/values/strings.xml +++ b/FlowCrypt/src/main/res/values/strings.xml @@ -379,8 +379,7 @@ Your email address Pending… Mark unread - User not verified - User not registered and not verified + User not verified successfully Submitting the pub key Saving the private key(s) Key already imported, finishing setup.