Password must contain at least 6 characters and one uppercase letter.

As the password is stored as a hash in a database, I added validation before the user is created.
My "improvement", didn't write it in the comment. I thought that having
only one uppercase letter is almost the same as having only one lowercase.

2014-12-23 13:04 GMT+01:00 Krzysztof Jurewicz <notifications@github.com>:

> In addons/bestja_volunteer/models.py
> <https://github.com/EE/bestja/pull/59#discussion-diff-22212645>:
>
> > @@ -89,3 +91,25 @@ def sync_group(self, group, domain):
> >          self.sudo().write({
> >              'groups_id': [(command, group.id)],
> >          })
> > +
> > +    @api.model
> > +    def signup(self, values, token=None):
> > +        """
> > +            Added for password validation: at least 6 characters, any letters,
> > +            any uppercase letter, not only lowercase.
> > +            You can't do it using constraints, as password is hashed in the database.
> > +        """
> > +        if (len(values.get('password')) < 6 or not re.search('[a-zA-Z]+', values.get('password'))
> > +                or values.get('password').islower() or values.get('password').isupper()):
> > +            raise SignupError("Hasło powinno zawierać co najmniej 6 znaków, w tym przynajmniej jedną wielka literę!")
>
> To be strict, the code says that also at least one lowercase letter is
> mandatory.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/EE/bestja/pull/59/files#r22212645>.
>