diff options
Diffstat (limited to 'api')
| -rw-r--r-- | api/auth/signup.py | 11 | ||||
| -rw-r--r-- | api/game/socket.py | 4 | ||||
| -rw-r--r-- | api/hierarchy.py | 2 | ||||
| -rw-r--r-- | api/user/password.py | 2 | 
4 files changed, 9 insertions, 10 deletions
| diff --git a/api/auth/signup.py b/api/auth/signup.py index a18796b..bf1208d 100644 --- a/api/auth/signup.py +++ b/api/auth/signup.py @@ -15,8 +15,7 @@ def validate_username(username):  # garbage email validation (see todo)  def validate_email(email):      #TODO: use node_modules/email-validator/index.js -    return len(email) > 1 and \ -                                         "@" in email +    return len(email) > 1 and "@" in email  # checks if the password is safe (regex explanation in pages/register.tsx) @@ -40,14 +39,14 @@ def index():      # return 400 (malformed request) if any of the required data is missing      if not username or \ -                                        not email or \ -                                        not password: +       not email or \ +       not password:          return "", 400      # return 403 (forbidden) if any of the required data is invalid      if not validate_username(username) or \ -                                        not validate_email(email) or \ -                                        not validate_password(password): +       not validate_email(email) or \ +       not validate_password(password):          return {"error": "form_data_invalid"}, 403      # check if username is taken diff --git a/api/game/socket.py b/api/game/socket.py index 587ad7d..eded965 100644 --- a/api/game/socket.py +++ b/api/game/socket.py @@ -22,12 +22,12 @@ def participants_only(func):          game_id = data["game_id"]          if not game_id or \ -                             not game_id in games: +		   not game_id in games:              return          game = games[game_id]          if game.player_1_id != user_id and \ -                             game.player_2_id != user_id: +           game.player_2_id != user_id:              return          return func(data, user_id, game) diff --git a/api/hierarchy.py b/api/hierarchy.py index 87b9db9..247ee9e 100644 --- a/api/hierarchy.py +++ b/api/hierarchy.py @@ -29,7 +29,7 @@ def util_two_id(type="user"):              # if there's an explicit_id, validate it using `type`              if explicit_id and \ -                                 not valid.validate(explicit_id, type): +			   not valid.validate(explicit_id, type):                  explicit_id = None              return func(token_id, explicit_id) diff --git a/api/user/password.py b/api/user/password.py index 731f7e4..2abbde6 100644 --- a/api/user/password.py +++ b/api/user/password.py @@ -10,7 +10,7 @@ def index():      data = request.get_json()      if not data["password"] or \ -                                        not data["newPassword"]: +       not data["newPassword"]:          return "", 400      return {}, 200 |