@app.route('/signin', methods=['GET', 'POST'])
def signin():
    if (request.method == 'POST'):
        username = request.form.get('username')
        password = request.form.get('password')
        usernamedata = db.execute('SELECT username FROM users WHERE username:=username', {'username': username}).fetchone()
        passworddata = db.execute('SELECT password FROM users WHERE password:=password', {'password': password}).fetchone()
        if (usernamedata is None):
            flash('NO username', 'danger')
            return render_template('signin.html')
        else:
            for password_data in passworddata:
                if sha256_crypt.verify(password, password_data):
                    flash('You are logged', 'success')
                    return redirect(url_for('profile'))
                else:
                    flash('Incorrect password', 'danger')
                    return render_template('signin.html')
    return render_template('signin.html')
@app.route('/signin', methods=['GET', 'POST'])
def signin():
    if (request.method == 'POST'):
        username = request.form.get('username')
        password = request.form.get('password')
        usernamedata = db.execute('SELECT username FROM users WHERE username:=username', {'username': username}).fetchone()
        passworddata = db.execute('SELECT password FROM users WHERE password:=password', {'password': password}).fetchone()
        if (usernamedata is None):
            flash('NO username', 'danger')
            return render_template('signin.html')
        else:
            for password_data in passworddata:
                if sha256_crypt.verify(password, password_data):
                    flash('You are logged', 'success')
                    return redirect(url_for('profile'))
                else:
                    flash('Incorrect password', 'danger')
                    return render_template('signin.html')
    return render_template('signin.html')