def register(): form = FormRegister() if form.validate_on_submit(): print("in") # catch time date_time = datetime.datetime.now() # user & email collision username = Account.query.filter( Account.username == form.username.data).first() email = Account.query.filter(Account.email == form.email.data).first() if username or email: return 'Username or Email collision' elif form.password.data != form.confirm.data: return 'two password is different' else: account = Account(uid=0, username=form.username.data, nickname=form.nickname.data, password=generate_password_hash( form.password.data), email=form.email.data, permLevel=False, signUpTime=date_time, lastLoginTime=date_time, icon=False) db.session.add(account) db.session.commit() flash('Success Thank You') return redirect(url_for('login')) return render_template('register.html', form=form)
def register(): form = FormRegister() conn = psycopg2.connect(database="DBMS_movie", user="******", password=IN1, host="127.0.0.1", port="5432") cur = conn.cursor() sql = "SELECT movie_name FROM movie_type " cur.execute(sql) movie = cur.fetchall() conn.close() movieArr = [] for mv in movie: movieArr.append((mv, mv[0])) form.m_name.choices = movieArr if form.submit.data or form.validate_on_submit(): c_name = request.form.get('c_name') c_phone = request.form.get('c_phone') c_id = request.form.get('c_id') c_list = request.form.get('c_list') m_name = request.form.get('m_name') print(f"mname = {m_name[2:-3]}") m_theater = request.form.get('m_theater') m_day = request.form.get('m_day') m_time = request.form.get('m_time') m_row = request.form.get('m_row') m_column = request.form.get('m_column') sql_cmd = inserttable(c_name, c_phone, c_id, c_list, m_name[2:-3], m_theater, m_day, m_time, m_row, m_column) query_data = db.engine.execute(sql_cmd) return render_template('index.html') return render_template('register.html', form=form)
def register(): form = FormRegister() if form.validate_on_submit(): user = UserRegister(username=form.username.data, email=form.email.data, password=form.password.data) db.session.add(user) db.session.commit() return '註冊成功!' return render_template('register.html', form=form)
def register(): from form import FormRegister from model import UserReister form = FormRegister() if form.validate_on_submit(): user = UserReister(username=form.username.data, email=form.email.data, password=form.password.data) db.session.add(user) db.session.commit() return 'Success Thank You' return render_template('register.html', form=form)
def register(): form = FormRegister() if form.validate_on_submit(): user = UserRegister(username=form.username.data, phone=form.phone.data, sex=form.sex.data, time=form.time.data, area=form.area.data) db.session.add(user) db.session.commit() return '報名成功!' return render_template('register.html', form=form)
def register(): from model import UserRegister from form import FormRegister form = FormRegister() if form.validate_on_submit(): visitor = UserRegister(username=form.username.data, email=form.email.data, phone=form.phone.data, hostname=form.hostname.data) db.session.add(visitor) db.session.commit() return 'Success Thank You!' return render_template('login.html', form=form)
def register(): from form import FormRegister from model import MemberData form = FormRegister() if form.validate_on_submit(): user = MemberData(UserID=form.UserID.data, MemberName=form.MemberName.data, MemberPhone=form.MemberPhone.data, MemberMail=form.MemberMail.data, MemberAccount=form.MemberAccount.data, MemberPassword=bcrypt.generate_password_hash( form.MemberPassword.data)) db.session.add(user) db.session.commit() flash('Congrates, registration success', category='success') return redirect(url_for('index')) return render_template('register.html', form=form)
def register(): form = FormRegister() if form.validate_on_submit(): user = { 'username': form.username.data, 'password': generate_password_hash(form.password.data) } api_url = 'http://104.46.235.6/create_user' resp = requests.post(url=api_url, params=user) if resp != None: res = { 'message': resp.json().get('message'), 'success': resp.json().get('success') } else: res = {'message': 'Request error.', 'success': False} return res return render_template('register.html', form=form)
def register(): from form import FormRegister form = FormRegister() if form.validate_on_submit(): username = form.username.data email = form.email.data idcard = form.idcard.data password = form.password.data hashed_pswd = generate_password_hash(password) user = database(username=username, email=email, idcard=idcard, password=hashed_pswd) if user != True: db.session.add(user) db.session.commit() return "success" else: return "error" return render_template('test.html', form=form)
def register(): form = FormRegister() if form.validate_on_submit(): return 'Success Thank You' return render_template('register.html', form=form)
def register(): form = FormRegister() if form.validate_on_submit(): return '註冊成功!' return render_template('register.html', form=form)