Skip to content

fix: Password length in settings and profile fragment #2090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class ProfileFragment : Fragment(), BottomIconDoubleClick {
layout.textInputLayoutNewPassword.isEndIconVisible = true
}

if (layout.newPassword.text.toString().length >= 6) {
if (layout.newPassword.text.toString().length >= MINIMUM_PASSWORD_LENGTH) {
layout.textInputLayoutNewPassword.error = null
layout.textInputLayoutNewPassword.isErrorEnabled = false
} else {
Expand All @@ -220,7 +220,7 @@ class ProfileFragment : Fragment(), BottomIconDoubleClick {
}
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand All @@ -245,7 +245,7 @@ class ProfileFragment : Fragment(), BottomIconDoubleClick {
}
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand All @@ -259,7 +259,7 @@ class ProfileFragment : Fragment(), BottomIconDoubleClick {
override fun afterTextChanged(p0: Editable?) {
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.fossasia.openevent.general.utils.extensions.setSharedElementEnterTran
import org.jetbrains.anko.design.longSnackbar
import org.jetbrains.anko.design.snackbar

private const val MINIMUM_PASSWORD_LENGTH = 8
const val MINIMUM_PASSWORD_LENGTH = 8

class SignUpFragment : Fragment() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.dialog_change_password.view.textInputLayou
import org.fossasia.openevent.general.BuildConfig
import org.fossasia.openevent.general.PLAY_STORE_BUILD_FLAVOR
import org.fossasia.openevent.general.R
import org.fossasia.openevent.general.auth.MINIMUM_PASSWORD_LENGTH
import org.fossasia.openevent.general.auth.ProfileViewModel
import org.fossasia.openevent.general.auth.SmartAuthUtil
import org.fossasia.openevent.general.auth.SmartAuthViewModel
Expand Down Expand Up @@ -189,7 +190,7 @@ class SettingsFragment : PreferenceFragmentCompat(), PreferenceChangeListener {
layout.textInputLayoutNewPassword.isEndIconVisible = true
}

if (layout.newPassword.text.toString().length >= 6) {
if (layout.newPassword.text.toString().length >= MINIMUM_PASSWORD_LENGTH) {
layout.textInputLayoutNewPassword.error = null
layout.textInputLayoutNewPassword.isErrorEnabled = false
} else {
Expand All @@ -204,7 +205,7 @@ class SettingsFragment : PreferenceFragmentCompat(), PreferenceChangeListener {
}
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand Down Expand Up @@ -234,7 +235,7 @@ class SettingsFragment : PreferenceFragmentCompat(), PreferenceChangeListener {
}
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand All @@ -253,7 +254,7 @@ class SettingsFragment : PreferenceFragmentCompat(), PreferenceChangeListener {
*/
when (layout.textInputLayoutConfirmNewPassword.isErrorEnabled ||
layout.textInputLayoutNewPassword.isErrorEnabled ||
layout.oldPassword.text.toString().length < 6) {
layout.oldPassword.text.toString().length < MINIMUM_PASSWORD_LENGTH) {
true -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
false -> alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
}
Expand Down