This is my code. I get this error everytime I press login:
'sqlite3.Cursor' object has no attribute '__getitem__'
This is my login tab:
@app.route('/', methods=['GET', 'POST'])
def login():error= Noneif request.method == "POST":with sql.connect("database.db") as con:cur = con.cursor()try:data = cur.execute("SELECT name FROM users WHERE name= ?",(request.form['username'],) )data.fetchone()if sha256_crypt.verify(request.form['password'], data[0]):session['logged_in'] == Truesession['username'] = request.form('username')flash('Successfully logged in')return redirect(url_for(hello_world))else:error = "Invalid Password or User. Try again."except Exception as e:flash(e)return render_template('login.html',error=error)con.close()gc.collect()return render_template('login.html', error=error)
What I am doing wrong?