API & Client - update username max length
This commit is contained in:
		@@ -74,7 +74,7 @@ def register_user() -> Union[Tuple[Dict, int], HttpResponse]:
 | 
			
		||||
        "status": "error"
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    :<json string username: user name (3 to 12 characters required)
 | 
			
		||||
    :<json string username: user name (3 to 30 characters required)
 | 
			
		||||
    :<json string email: user email
 | 
			
		||||
    :<json string password: password (8 characters required)
 | 
			
		||||
    :<json string password_conf: password confirmation
 | 
			
		||||
@@ -84,7 +84,9 @@ def register_user() -> Union[Tuple[Dict, int], HttpResponse]:
 | 
			
		||||
        - invalid payload
 | 
			
		||||
        - sorry, that user already exists
 | 
			
		||||
        - Errors:
 | 
			
		||||
            - username: 3 to 12 characters required
 | 
			
		||||
            - username: 3 to 30 characters required
 | 
			
		||||
            - username: only alphanumeric characters and the underscore
 | 
			
		||||
                        character "_" allowed
 | 
			
		||||
            - email: valid email must be provided
 | 
			
		||||
            - password: password and password confirmation don't match
 | 
			
		||||
            - password: 8 characters required
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ BaseModel: DeclarativeMeta = db.Model
 | 
			
		||||
class User(BaseModel):
 | 
			
		||||
    __tablename__ = 'users'
 | 
			
		||||
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
 | 
			
		||||
    username = db.Column(db.String(20), unique=True, nullable=False)
 | 
			
		||||
    username = db.Column(db.String(255), unique=True, nullable=False)
 | 
			
		||||
    email = db.Column(db.String(120), unique=True, nullable=False)
 | 
			
		||||
    password = db.Column(db.String(255), nullable=False)
 | 
			
		||||
    created_at = db.Column(db.DateTime, nullable=False)
 | 
			
		||||
@@ -32,7 +32,7 @@ class User(BaseModel):
 | 
			
		||||
    picture = db.Column(db.String(255), nullable=True)
 | 
			
		||||
    timezone = db.Column(db.String(50), nullable=True)
 | 
			
		||||
    # does the week start Monday?
 | 
			
		||||
    weekm = db.Column(db.Boolean(50), default=False, nullable=False)
 | 
			
		||||
    weekm = db.Column(db.Boolean, default=False, nullable=False)
 | 
			
		||||
    workouts = db.relationship(
 | 
			
		||||
        'Workout',
 | 
			
		||||
        lazy=True,
 | 
			
		||||
 
 | 
			
		||||
@@ -40,8 +40,8 @@ def check_username(username: str) -> str:
 | 
			
		||||
    Return if username is valid
 | 
			
		||||
    """
 | 
			
		||||
    ret = ''
 | 
			
		||||
    if not 2 < len(username) < 13:
 | 
			
		||||
        ret += 'username: 3 to 12 characters required\n'
 | 
			
		||||
    if not (2 < len(username) < 31):
 | 
			
		||||
        ret += 'username: 3 to 30 characters required\n'
 | 
			
		||||
    if not re.match(r'^[a-zA-Z0-9_]+$', username):
 | 
			
		||||
        ret += (
 | 
			
		||||
            'username: only alphanumeric characters and the '
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user