Even password and confirm password don' match, it doesn't give me feedback about that. Also even I write email like that 'vmdfjk@hot' my code except this email I dont know why and Im really confused. Thanks alredy!
from flask import Flask, render_template, flash, redirect, url_for, session, logging, request
import socket
import sqlite3
from wtforms import Form, BooleanField, StringField, PasswordField, validators, ValidationError, SubmitField ,EmailField
from passlib.hash import sha256_crypt
from wtforms.validators import *
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.secret_key="nane"
class RegisterForm(Form):
name = StringField("İsim Soyisim :", validators=[validators.DataRequired(), validators.Length(min=4, max=25)])
username = StringField("Kullanici Adi :", validators=[validators.DataRequired(), validators.Length(min=5, max=15)])
email = EmailField("Email Adresi :", validators=[validators.DataRequired(), validators.Email(message="Lütfen geçerli bir adres girin!")])
password = PasswordField("Parola : ", validators=[
validators.DataRequired(message="Parola girin!"),
validators.EqualTo("confirm", message="Parolaniz uyusmadi!")
])
confirm = PasswordField("Parolayi yeniden girin : ")
@app.route("/register", methods=["GET", "POST"]) # METHODS, BU URL HEM GET HEM DE POST REQUEST ALABİLİR DEMEKTİR.
def register():
form = RegisterForm(request.form)
if request.method == "POST" and form.validate:
flash("Başarıyla kayıt oldunuz", "success")
return redirect(url_for("index")) # fonksiyonu index olan url adresine gider
else:
pass
return render_template("register.html", form=form)
I am expecting to work correctly
For a call to validate
, the associated parentheses are missing. For this reason, any attempt to validate returns a positive result.
@app.route("/register", methods=["GET", "POST"])
def register():
form = RegisterForm(request.form)
if request.method == "POST" and form.validate():
flash("Başarıyla kayıt oldunuz", "success")
return redirect(url_for("index"))
return render_template("register.html", form=form)