fix reset start
This commit is contained in:
@@ -254,7 +254,37 @@ def start_register():
|
|||||||
|
|
||||||
@app.route("/panel/auth/reset", methods=["POST"])
|
@app.route("/panel/auth/reset", methods=["POST"])
|
||||||
def start_resetpass():
|
def start_resetpass():
|
||||||
return jsonify(hello="ameye world")
|
try:
|
||||||
|
data = request.json
|
||||||
|
if not data:
|
||||||
|
return {
|
||||||
|
"message": "Please provide username ",
|
||||||
|
"data": None,
|
||||||
|
"error": "Bad request"
|
||||||
|
}, 400
|
||||||
|
# validate input
|
||||||
|
print(data)
|
||||||
|
is_validated = validate.validate_username(data.get('username'))
|
||||||
|
if is_validated is not True:
|
||||||
|
return dict(message='Invalid data', data=None, error=is_validated), 400
|
||||||
|
|
||||||
|
username= data.get('username')
|
||||||
|
sql = "INSERT INTO password_reset (username) VALUES (%s)"
|
||||||
|
val = (username)
|
||||||
|
with connection:
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute(sql, val)
|
||||||
|
connection.commit()
|
||||||
|
last_row_id=cursor.lastrowid
|
||||||
|
|
||||||
|
return jsonify(hello="ameye reset path world", last_row_id=last_row_id)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return {
|
||||||
|
"message": "Something went wrong!",
|
||||||
|
"error": str(e),
|
||||||
|
"data": None
|
||||||
|
}, 500
|
||||||
|
|
||||||
|
|
||||||
@app.route("/panel/account")
|
@app.route("/panel/account")
|
||||||
|
|||||||
Reference in New Issue
Block a user