kblincoe / QualOpt_SE701

2 stars 15 forks source link

[Bug] Constraints needed on creating new participants #115

Open victorlian opened 6 years ago

victorlian commented 6 years ago

Description When creating a new participant under admin mode, the form asks for "number of contributions" and "number of repositories". This is expected to be a positive integer. No form validation is implemented. This could cause: negative numbers, decimals and weird things to be entered and actually stored. There is also no upper/lower limit, which could make the server overflow the int (there is validation here to stop this being stored).

Screenshots of bug image Highlighted in yellow: no form validation Circled in red: overflow causing error

How to reproduce

  1. Login in using admin/admin, go to participants page, attempt to add a participant.
  2. When entering numbers, try -5 and -5.3, both passes validation and gets stored as -5.
  3. Also try enter a huge negative number, say -999999999999999999999, this will cause the server to throw an error (as shown in screenshot)

Acceptance criteria

  1. There is upper/lower, integer and positive number only constraints applied.
  2. When the user enters values that are invalid, a red error message should prompt the user about the error. This error message should be styled consistently as other error messages in forms. (such as those in changing the password).
  3. [updated on 2018/03/18] Validation should also be performed on the email address, see Will's comment below.
  4. When the user enters values that are invalid, the "save" button is disabled.
victorlian commented 6 years ago

Dependency

34 Link filtering participants to studies

The participants page might be removed for the users page. It may still be helpful for the admin page though. (Since general users should not be adding participants)

Before fixing this issue, a decision should be made on whether the participant page will remain in the admin view.

victorlian commented 6 years ago

@softeng-701 suggested size of issue: small.

will-molloy commented 6 years ago

Hi Victor. A similar issue is if the Participants email address is not a valid internet address: screenshot from 2018-03-18 19-48-53 This exception is only thrown when attempting to email the participant, i.e. clicking 'Send Invitation' for some study. This isn't to be confused with them entering a valid address but invalid email as this will bounce back (see #36) rather than out right failing to send.

victorlian commented 6 years ago

@wilmol Hi Will, I was expecting #14 "Fix validation of email format" to fix this. But I guess they forgot to fix it for adding participants (probably because you have to login as admin) So yes, email validation should also be done here, I'll update the acceptance criteria.

softeng-701 commented 6 years ago

@wilmol @victorlian small?

victorlian commented 6 years ago

@softeng-701 yes I would still suggest small.

will-molloy commented 6 years ago

@softeng-701 yes

softeng-701 commented 6 years ago

@victorlian @wilmol APPROVED!