def register(): if request.method == 'GET': email = session['email'] return render_template("register.html", email) else: #회원정보 생성 verification = 0 login_session = 'False' customer_name = request.form.get('customer_name') email = session['email'] customer_pass = request.form.get('customer_pass') repass = request.form.get('repass') print( "---------------------------------------------------------------------------------------------------------" ) print("input customer_pass: "******"---------------------------------------------------------------------------------------------------------" ) if not (email and customer_name and customer_pass and repass): return "모두 입력해주세요" elif customer_pass != repass: return "비밀번호를 확인해주세요" else: #모두 입력이 정상적으로 되었다면 밑에명령실행(DB에 입력됨) fcuser = Fcuser() fcuser.email = email #models의 FCuser 클래스를 이용해 db에 입력한다. fcuser.customer_name = customer_name fcuser.customer_pass = customer_pass fcuser.login_session = login_session fcuser.verification = verification cursor = connection.cursor() query = ( "insert into customers" + "(customer_id, email, customer_name, customer_pass, login_session, verification) " + "values(customer_seq.currval," + "'" + email + "', " + "'" + customer_name + "', " + "'" + customer_pass + "', " + "'" + "False', " + "0)") print(query) cursor.execute(query) print( "---------------------------------------------------------------------------------------------------------" ) print("insert query done.") return redirect('/')
def register(): if request.method == 'GET': return render_template("register.html") else: #회원정보 생성 userid = request.form.get('userid') password = request.form.get('password') re_password = request.form.get('re_password') username = request.form.get('username') birth_year = request.form.get('birth_year') sex = request.form.get('sex') email = request.form.get('email') print(password) # 들어오나 확인해볼 수 있다. if not (userid and username and password and re_password and username and birth_year and sex and email) : flash("모두 입력해라") return render_template('register.html') elif password != re_password: flash("비밀번호 확인해라") return render_template('register.html') else: #모두 입력이 정상적으로 되었다면 밑에명령실행(DB에 입력됨) fcuser = Fcuser() fcuser.userid = userid fcuser.password = password #models의 FCuser 클래스를 이용해 db에 입력한다. fcuser.username = username fcuser.birth_year = birth_year fcuser.sex = sex fcuser.email = email db.session.add(fcuser) db.session.commit() flash('회원가입 완료') return render_template('login.html') return redirect('/')