check email and username before start installation

Bug #1166797 reported by Matteo Nastasi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenQuake Platform
Won't Fix
Undecided
Unassigned

Bug Description

After some installation failure I found into django code how it validate email and username.

To be more consistent we can add this 2 check inside our installation script to avoid waste of time
during installation with wrong parameters.

import re

RE_VALID_USERNAME = re.compile('[\w.@+-]+$')

EMAIL_RE = re.compile(
    r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
    r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"' # quoted-string
    r')@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain

def is_valid_email(value):
    if not EMAIL_RE.search(value):
        raise exceptions.ValidationError(_('Enter a valid e-mail address.'))

if not RE_VALID_USERNAME.match(username):
                raise CommandError("Invalid username. Use only letters, digits, and underscores")

Changed in oq-platform:
milestone: none → 1.13.0
Revision history for this message
Daniele Viganò (daniele-vigano) wrote :

Behaviors have changed in oq-platform 2.0

Changed in oq-platform:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.