From e879f39c485e2542430a6a55d09fd4dfbc5236c3 Mon Sep 17 00:00:00 2001 From: muchwowmining Date: Sat, 19 Mar 2022 19:07:06 +0100 Subject: [PATCH] Regex address check --- yellow/routes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yellow/routes.py b/yellow/routes.py index 1bb801f..b2c9da9 100644 --- a/yellow/routes.py +++ b/yellow/routes.py @@ -1,4 +1,5 @@ from quart import render_template, request, redirect, url_for, jsonify, Blueprint, abort, flash, send_from_directory, session +import re from yellow import login_required from yellow.factory import openid @@ -36,9 +37,7 @@ async def dashboard_address_post(): # get FORM POST value 'address' form = await request.form address = form.get('address') - if len(address) != 97: - raise Exception("Please submit a WOW address") - elif not address.isalnum(): + if not bool(re.match(r'^(WW)\\d[0-9A-Za-z]{94}$', address)): raise Exception("Please submit a WOW address") # update user