Пример #1
0
 def POST(self):
     f=form.register_form()
     if not f.validates():
         return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).register(f)
     else:
         reginfo=web.input()
         msg=models.check_register(reginfo.username,reginfo.password,reginfo.invcod)
         if msg!='':
             return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).register(f,msg)
         else:
             raise web.seeother("/../")
Пример #2
0
def register():
	form = register_form(request.form)
	print(form.validate())
	if request.method =='POST' and form.validate():
		print('Ok')
		name = form.name.data
		email = form.email.data
		password = form.password.data
		cur = mysql.connection.cursor()
		cur.execute("""INSERT INTO user (name,email,password)
						VALUES (%s, %s, %s)""",(name,email,password))
		mysql.connection.commit()
		cur.close()
		return redirect(url_for('login'))
	else:
		return render_template('register.html', form = form)		
Пример #3
0
 def GET(self):
     f=form.register_form()
     return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).register(f)