def bilgileriguncelle(): ceptel = request.form.get("inp_ceptel") sifre = request.form.get("inp_sifre") sifretekrar = request.form.get("inp_sifretekrar") eposta = request.form.get("inp_eposta") adsoyad = request.form.get("inp_adsoyad") if sifre != None and sifretekrar != None: if sifre == sifretekrar: query = Kullanici.update( adsoyad=adsoyad, eposta=eposta, ceptel=ceptel, sifre=generate_password_hash(sifre)).where( Kullanici.kullaniciadi == session["kadi"]) result = query.execute() else: result = "Girilen Şifreler birbiri ile uyuşmuyor" else: query = Kullanici.update(adsoyad=adsoyad, eposta=eposta, ceptel=ceptel) result = query.execute() if result: flash("Profil bilgileri başarıyla Güncellendi !", category="alert alert-success") else: flash("Güncelleme esnasında bir problem var !", category="alert alert-danger") return redirect("/bilgilerim")
def websiteguncelle(): website = request.form.get("inp_website") query = Kullanici.update(websayfasi=website).where( Kullanici.kullaniciadi == session["kadi"]) result = query.execute() if result: flash("Web Sayfası başarıyla Güncellendi !", category="alert alert-success") else: flash("Güncelleme esnasında bir problem var !", category="alert alert-danger") return redirect("/bilgilerim")
def profilfotografekle(): file = request.files['inp_profilphoto'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) query = Kullanici.update(profilresmi=filename).where( Kullanici.kullaniciadi == session["kadi"]) result = query.execute() if result: flash("Profil resmi başarıyla Güncellendi !", category="alert alert-success") else: flash("Güncelleme esnasında bir problem var !", category="alert alert-danger") return redirect("/bilgilerim")
def kayitol(): error = "" if request.method == "POST": adsoyad = request.form.get("inp_adsoyad") kadi = request.form.get("inp_eposta") sifre = request.form.get("inp_pass") sifretekrar = request.form.get("inp_repass") if sifre == sifretekrar: user = Kullanici.create(adsoyad=adsoyad, kullaniciadi=kadi, sifre=generate_password_hash(sifre)) user.save() return redirect("/") else: error = "Girilen Şifreler birbiri ile uyuşmuyor" return render_template("kayit.html", hata=error)
def girisyap(): kadi = request.form.get("inp_kadi") sifre = request.form.get("inp_sifre") query = Kullanici.select().where((Kullanici.kullaniciadi == kadi)).limit(1) gelenad = "" hash_sifre = "" kullaniciad = "" for row in query: gelenad = row.adsoyad hash_sifre = row.sifre kullaniciad = row.kullaniciadi profilresmi = row.profilresmi adsoyad = row.adsoyad if gelenad != "" and check_password_hash(hash_sifre, sifre): session["kadi"] = kullaniciad session["profilresmi"] = profilresmi session["adsoyad"] = adsoyad return redirect("/") else: return render_template("index.html", hata="girilen kullanıcı adı veya şifre yanlış")
def anasayfa(): # POST işleminde giriş yap gerçekleşiyor if request.method == "POST": kadi = request.form.get("inp_email") sifre = request.form.get("inp_sifre") query = Kullanici.select().where( (Kullanici.kullaniciadi == kadi)).limit(1) gelenad = "" hash_sifre = "" kullaniciad = "" for row in query: gelenad = row.adsoyad hash_sifre = row.sifre kullaniciad = row.kullaniciadi if gelenad != "" and check_password_hash(hash_sifre, sifre): session["kadi"] = kullaniciad return redirect("tumnotlar") else: return render_template( "index.html", hata="girilen kullanıcı adı veya şifre yanlış") return render_template("index.html")
def admin(): if "kadi" in session: kullanici = Kullanici.select().where( Kullanici.kullaniciadi == session["kadi"]).dicts().get() return render_template("bilgilerim.html", kisi=kullanici)