codetriage / docs_doctor

http://docsdoctor.org
27 stars 21 forks source link

Fix user#edit form. #30

Closed tejasbubane closed 9 years ago

tejasbubane commented 9 years ago

Fixes #29

The edit page was throwing error since :daily_issue_limit and :skip_issues_with_pr fields were not present on user model. I have made the edit page consistent with the user#show page with only two fields email and private/public.

Also the password-length validation failed while updating user since the password field was empty. So I put in a condition on the validation.

prathamesh-sonpatki commented 9 years ago

@tejasbubane I think we should just put allow_blank: true for password validation because we are logging in using Github auth. This will be in consistent with how we handle it in CodeTriage.

schneems commented 9 years ago

Seems good, curious but why || user.encrypted_password.nil? We want to verify the password length when it's present that makes sense, but if the password isn't present, wouldn't the encrypted_password.nil? always be true?

tejasbubane commented 9 years ago

@schneems I misread it to be validates instead of validates_length. I think it makes sense in that case, correct me if I am wrong. Anyways, I am updating the PR as per @prathamesh-sonpatki's suggestion.

prathamesh-sonpatki commented 9 years ago

@schneems we don't need password actually. We use github auth right?

schneems commented 9 years ago

Yeah, it's the same as Code Triage which has:

  validates_length_of     :password, within:  8..128, allow_blank: true
prathamesh-sonpatki commented 9 years ago

:+1:

tejasbubane commented 9 years ago

@prathamesh-sonpatki PR updated.