def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user_email = form.email.data user = User.query.get(user_email) if user is None: user = User( email=form.email.data, password=generate_password_hash(form.password.data) ) db.session.add(user) db.session.commit() session.permanent = True session['user_email'] = user.email # flash(u'로그인 완료', 'success') return redirect(url_for('tutorial_page')) #회원가입이 완료되면 튜토리얼 페이지로 이동 else: flash(u'이미 존재하는 USER', 'danger') return redirect(url_for('user_join')) # 만약 존재하는 회원이면 경고! else: flash(u'작성형식에 맞지 않습니다.', 'success') return redirect(url_for('user_join')) # 작성형식에 맞지 않으면 경고! else: return render_template('user/join.html', form=form, active_tab="user_join") # URL을 눌러 접속하면 user_join 으로 이동
def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = User(email=form.email.data, password=generate_password_hash(form.password.data), name=form.name.data) db.session.add(user) db.session.commit() flash(u'가입이 완료되었습니다.', 'success') return redirect(url_for('article_list')) return render_template('user/join.html', form=form, active_tab='article_create')
def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = User( email = form.email.data, password = generate_password_hash(form.password.data), name = form.name.data ) db.session.add(user) db.session.commit() flash(u'가입이 완료되었습니다.', 'success') return redirect(url_for('article_list')) return render_template('user/join.html', form = form, active_tab = 'article_create')
def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = User( email=form.email.data, password=generate_password_hash(form.password.data), name=form.name.data, join_date = kstime(9) ) db.session.add(user) db.session.commit() return redirect(url_for('user_interest', user_id = user.id)) #if GET return render_template('user/join.html', form=form, active_tab='user_join')
def member_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = Member(email=form.email.data, pw=generate_password_hash(form.password.data), name=form.name.data, grade=form.grade.data, major=form.major.data, univname=form.univname.data) db.session.add(user) db.session.commit() flash(u'가입이 완료 되었습니다.', 'success') return redirect(url_for('index')) return render_template('user/join.html', form=form, active_tab='member_join')
def member_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = Member( email=form.email.data, pw=generate_password_hash(form.password.data), name=form.name.data, grade=form.grade.data, major=form.major.data, univname=form.univname.data ) db.session.add(user) db.session.commit() flash(u'가입이 완료 되었습니다.','success') return redirect(url_for('index')) return render_template('user/join.html' , form=form, active_tab='member_join')
def user_join(): form = JoinForm() if form.validate_on_submit(): user = User( email = form.email.data, password = generate_password_hash(form.password.data), name = form.name.data, birthday = form.birthday.data ) year=datetime.date.today().strftime("%Y") user.age = int(year)-int(user.birthday.year) +1 db.session.add(user) db.session.commit() session.permanent = True session['user_email'] = user.email session['user_name'] = user.name return redirect(url_for('index')) else: return render_template("login.html", form = form, joinModalOn='True')
def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): user = User( user_id = form.user_id.data, name=form.name.data, email=form.email.data, place_name=form.place_name.data, password=generate_password_hash(form.password.data) ) mydb.session.add(user) mydb.session.commit() #flash(u'가입이 완료 되었습니다.', 'success') #수정 return redirect(url_for('user_login')) #if GET return render_template('main/join.html', form=form, active_tab='user_join')
def user_join(): form = JoinForm() if request.method == 'POST': user = User(email=form.email.data, password=generate_password_hash(form.password.data), name=form.name.data) db.session.add(user) db.session.commit() flash(u'가입이 승인되었습니다. 비밀번호는 암호화되어 저장되어 관리자도 알 수 없습니다.', 'success') return redirect(url_for('article_list')) else: flash(u'비밀코드가 맞지 않습니다. 관리자에게 문의하세요.', 'danger') return render_template('user/join.html', form=form, active_tab='user_join')
def user_join(): form = JoinForm() if request.method == 'POST': if form.validate_on_submit(): id = request.form['id'] email = request.form['email'] password = request.form['password'] name = request.form['name'] user = User( email=email, password=generate_password_hash(password), name=name ) db.session.add(user) db.session.commit() return redirect(url_for('index')) #if GET return render_template('join.html') # # @Login controllers # @app.route('/login', methods=['GET','POST']) def log_in(): form = LoginForm() if request.method == 'POST': if form.validate_on_submit(): id = request.form["id"] password = request.form["password"] user = User.query.get(id) #message = None if user is None: flash (u'user가 존재하지 않습니다', 'danger') elif not check_password_hash(user.password, password): flash(u'password가 잘못되었습니다.','danger') else: session.permanent = True session['user_id'] = user.email session['user_name'] = user.name flash(u'로그인 완료', 'success') return redirect(url_for('main')) #if GET return render_template('index.html', form = form, active_tab = 'log_in') @app.route('/main') def main(): return render_template('main.html') @app.route('/logout') def log_out(): session.clear() #if GET return redirect(url_for('index'))
def index(): return render_template('index.html', form2=JoinForm(), form=LoginForm(), city_title=u"서울시")
def main(): return render_template('main.html', form2=JoinForm(), form=LoginForm())