Issue
- I have a method in this I am extracting email id and mobile number from the database.
- I am using POSTGRES as database and using python language.I need to pass the value to the second method for the OTP purpose but I am running into an error.
@app.route("/", methods=['GET', 'POST'])
def userlogin():
sql_mobile_query = """SELECT users.phone FROM users WHERE users.email = %s"""
cursor.execute(sql_mobile_query, record_to_search)
mobile = cursor.fetchone()
mobile_new = mobile[0]
sql_email_query = """SELECT users.email FROM users WHERE users.email = %s"""
cursor.execute(sql_email_query, record_to_search)
email = cursor.fetchone()
email_new = email[0]
connection.commit()
if(role == ('Admin',) and eotp == ('False',) and motp == ('False')):
return "No need of OTP"
else:
return redirect(url_for('otp', email=email_new , mobile=mobile_new))
connection.commit()
print("Logged in sucessfully")
- I have another method I need to access the email id and mobile number in this method that is passed from the above
userlogin()
method
@app.route("/otp/<email>/<mobile>", methods=['GET', 'POST'])
def otp(email, mobile):
email = email
mobile = mobile
print(email, mobile)
return render_template("otp_screen.html")
Solution
Solved. I just don't have to assign new variable in this method @app.route("/otp/<email>/<mobile>", methods=['GET', 'POST'])
Answered By - Lav Sharma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.