Skip to content

Conversation

@shikhart98
Copy link
Contributor

@shikhart98 shikhart98 commented Sep 26, 2018

ScreenShot:
whatsapp image 2018-09-26 at 6 20 24 am


Fixes #585

@iamareebjamal
Copy link
Member

Please follow commit guidelines

@shikhart98
Copy link
Contributor Author

I'll commit code for constraints today itself, and then if you want I can squash all commits.

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/password_constraints"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This textview is not required IMO

Copy link
Contributor Author

@shikhart98 shikhart98 Sep 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at the time of signup we should tell user about the constraints. It is not required in login page.

@shikhart98 shikhart98 closed this Sep 27, 2018
@shikhart98 shikhart98 reopened this Sep 27, 2018
@shikhart98
Copy link
Contributor Author

Please Review my PR.

@iamareebjamal
Copy link
Member

This should be handled in a way that if the password does not follow constraints, show them a warning or error. Not always

@shikhart98
Copy link
Contributor Author

@iamareebjamal Okay sir, so should I place a toast whenever user enters a password less than 6 characters?

@iamareebjamal
Copy link
Member

No, display TextInputLayout error

@shikhart98
Copy link
Contributor Author

@iamareebjamal I have taken care of the error message this time. Now until and unless user writes a password greater than or equal to 6 characters this warning in red will be displayed (it will not be displayed initially when length of password is zero or when user clears the password field)
whatsapp image 2018-09-30 at 10 28 58 am whatsapp image 2018-09-30 at 10 33 06 am whatsapp image 2018-09-30 at 10 33 06 am 1

Copy link
Member

@simarsingh24 simarsingh24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you fixing length to 6? I guess we ill have to ask the mentors for the limit @iamareebjamal what are your views?

@shikhart98
Copy link
Contributor Author

Explanation for latest commit ( b737bc4 ) : What if user clicks the sign up button even after seeing the warning? Later the application let user to signup, but now it will show a toast as shown below and won't let user to signup until and unless user obeys the password constraints.
whatsapp image 2018-09-30 at 8 29 14 pm

@shikhart98
Copy link
Contributor Author

@simarsingh24 When I posted the issue no one commented on this thing! You can tell me the limit, no problem.


signUpActivityViewModel.error.observe(this, Observer {
Toast.makeText(context, it, Toast.LENGTH_LONG).show()
Toast.makeText(context, it, Toast.LENGTH_LONG).show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indentation

else -> textInputLayoutPassword.error = "Password too short!"
}
}
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments about empty body

}
}
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments about empty body

error.value = "Passwords do not match!"
return true
}
if(password.length <6){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline above this line and space before and after parens

shikhart98 added a commit to shikhart98/open-event-android that referenced this pull request Oct 1, 2018
shikhart98 added a commit to shikhart98/open-event-android that referenced this pull request Oct 2, 2018
textInputLayoutPassword.error = null
textInputLayoutPassword.isErrorEnabled = false
}
else -> textInputLayoutPassword.error = "Password too short!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be if else

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously I wrote 'If else' statement here but then kotlin gave me this suggestion(to use when)! If you want I can roll back to 'If else' statement

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please move back to if else. When is like switch case and should be used when there are multiple cases

rootView.passwordSignUp.addTextChangedListener(object : TextWatcher{
override fun afterTextChanged(p0: Editable?) {
when {
(passwordSignUp.text.toString().length>=6 || passwordSignUp.text.toString().isEmpty()) -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second case is redundant. First case already checks that the string can't be empty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal Suppose user writes a password of less than 6 characters (error message appears), now user clear the password field (now because the password field is empty there should not be any error message, this situation is same as if user didn't type any password)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal My second case is if the string is empty then also remove the error message!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah alright, my mistake. I didn't see the condition quite clearly 👍

@shikhart98
Copy link
Contributor Author

Please merge this PR

simarsingh24
simarsingh24 previously approved these changes Oct 6, 2018
redirectToMain()
})

rootView.passwordSignUp.addTextChangedListener(object : TextWatcher{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space after TextWatcher

}

if (password.length < 6) {
error.value = "Password should be greater than 6 characters!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

atleast 6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

iamareebjamal
iamareebjamal previously approved these changes Oct 7, 2018
<!--settings profile dialog-->
<string name="message">Are you sure you want to log out?</string>
<string name="cancel">Cancel</string>
<string name="password_constraints">* Atleast 6 characters</string>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it is not used! I'll remove this today itself!

shikhart98 added a commit to shikhart98/open-event-android that referenced this pull request Oct 9, 2018
shikhart98 added a commit to shikhart98/open-event-android that referenced this pull request Oct 9, 2018
@liveHarshit
Copy link
Member

I think something went wrong!
git showed me this
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

then I did

git pull upstream development --rebase
git push origin bb -f

Now all my previous commits are stacked here again :/ can anyone help?

@shikhart98 Simply follow these steps :

  • run git checkout bb
  • run git pull --rebase upstream development
  • run git log
  • copy the latest commit id of (upstream->development)
  • run git reset --soft "paste commit id here"
  • now commit your changes 'git commit'
  • now run git push origin +bb

@shikhart98
Copy link
Contributor Author

@liveHarshit its all sorted now :)
@nikit19 @simarsingh24 @iamareebjamal Please review!

@liveHarshit
Copy link
Member

@liveHarshit its all sorted now :)
@nikit19 @simarsingh24 @iamareebjamal Please review!

@shikhart98 But you have nine commits, so you need to squash them. Simply follow the steps.

@simarsingh24
Copy link
Member

squash your commits

Copy link
Member

@nikit19 nikit19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please squash your commits

@iamareebjamal iamareebjamal merged commit 59088b2 into fossasia:development Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants