示例#1
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, register_form=f)
     elif len(f.d.username) > 16 :
         return render_account(
             show = 'register_only',
             error_message = '<span class="alert alert-error">不能超过16位</span>',
             register_form=f
         )
     elif len(f.d.username) < 2 :
         return render_account(
             show = 'register_only',
             error_message = '<span class="alert alert-error">不能少过2位</span>',
             register_form=f
         )
     elif not (re.search('^[a-zA-Z]{1}[\w\-]{5,15}$', f.d.username)):
         return render_account(
             show = 'register_only',
             error_message = '<span class="alert alert-error">请以字母开头,6-16个字母、数字</span>',
             register_form=f
         )
     else:
         users.create_account(f.d.username, f.d.email, f.d.password, f.d.nickname)
         session.login(f.d.email)
         raise web.seeother('/')
示例#2
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, register_form=f)
     elif len(f.d.username) > 16:
         return render_account(
             show='register_only',
             error_message='<span class="alert alert-error">不能超过16位</span>',
             register_form=f)
     elif len(f.d.username) < 2:
         return render_account(
             show='register_only',
             error_message='<span class="alert alert-error">不能少过2位</span>',
             register_form=f)
     elif not (re.search('^[a-zA-Z]{1}[\w\-]{5,15}$', f.d.username)):
         return render_account(
             show='register_only',
             error_message=
             '<span class="alert alert-error">请以字母开头,6-16个字母、数字</span>',
             register_form=f)
     else:
         users.create_account(f.d.username, f.d.email, f.d.password,
                              f.d.nickname)
         session.login(f.d.email)
         raise web.seeother('/')
示例#3
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, login_form=f)
     else:
         session.login(f.d.email)
         raise web.seeother('/')
示例#4
0
 def POST(self):
     f = web.input(regNickname="", regUserName="", regEmail="", regUserPassword="", regUserPassword2="")
     users.create_account(f.regUserName, f.regEmail, f.regUserPassword, f.regNickname) #用户表入库
     token = md5.md5(time.ctime() + f.regEmail).hexdigest()
     email_templates.create_account(f.regEmail, token)
     users.save_confirm_email(f.regEmail, token)
     session.login(f.regEmail)
     raise web.seeother('/')
示例#5
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, login_form=f)
     else:
         session.login(f.d.email)
         raise web.seeother('/')
示例#6
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, register_form=f)
     else:
         users.create_account(f.d.email, f.d.password, f.d.nickname)
         session.login(f.d.email)
         raise web.seeother('/')
示例#7
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, register_form=f)
     else:
         users.create_account(f.d.email, f.d.password, f.d.nickname)
         session.login(f.d.email)
         raise web.seeother('/')
示例#8
0
 def POST(self):
     f = self.form()
     if not f.validates(web.input(_unicode=False)):
         show = web.input(show='all').show
         return render_account(show, login_form=f)
     else:
         # print '####', f.d.username
         # print session.get_user_id()
         session.login(f.d.username)
         raise web.seeother('/')
示例#9
0
 def POST(self):
     data = web.input()
     email = data.loginEmail
     password = data.loginPassword
     if not users.is_correct_password(email, password):
         # Validform插件需要返回JSON格式的数据
         return '{"info":"邮箱或密码有误","status":"n"}'
     else:
         session.login(email)
         # raise web.seeother('/')
         return '{"info":"登录成功,欢迎回来","status":"y"}'
示例#10
0
 def POST(self):
     data = web.input()
     email = data.loginEmail
     password = data.loginPassword
     if not users.is_correct_password(email, password):
         # Validform插件需要返回JSON格式的数据
         return '{"info":"邮箱或密码有误","status":"n"}' 
     else:
         session.login(email)
         # raise web.seeother('/')
         return '{"info":"登录成功,欢迎回来","status":"y"}'
示例#11
0
 def POST(self):
     f = mww.MyForm(self.login_form(), '/cumt/Login')
     ipt = web.input(_unicode=False)
     if not f.form.validates(ipt):
         # show = ipt.get('show','all')
         show = web.input(show='all').show
         r = mww.Panel('Login', f.render_css()).render()
         return render.l12(page=r)
     else:
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
示例#12
0
 def POST(self):
     f = web.input(regNickname="",
                   regUserName="",
                   regEmail="",
                   regUserPassword="",
                   regUserPassword2="")
     users.create_account(f.regUserName, f.regEmail, f.regUserPassword,
                          f.regNickname)  #用户表入库
     token = md5.md5(time.ctime() + f.regEmail).hexdigest()
     email_templates.create_account(f.regEmail, token)
     users.save_confirm_email(f.regEmail, token)
     session.login(f.regEmail)
     raise web.seeother('/')
示例#13
0
 def POST(self):
     f = mww.MyForm(self.register_form(), '/cumt/SignUp')
     ipt = web.input(_unicode=True)
     if not f.form.validates(ipt):
         show = web.input(show='all').show
         r = mww.Panel(u'注册', f.render_css()).render()
         return render.l12(page=r)
     else:
         users.create_account(email=f.form.d.email,
                              password=f.form.d.password,
                              privilege=1)
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
示例#14
0
 def POST(self):
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.register_detail_form(), '/cumt/Profile')
     if not f.form.validates(ipt):
         s = mww.ListGroup(session.get_session().actions).render()
         l = mww.Panel('Settings', s)
         r = mww.Panel('Profile', f.render_css())
         return render.l3r9(left=l.render(), right=r.render())
     else:
         users.update(
             session.get_session().uid,
             **utils.extract_info_from_storage_by_list(ipt, PROPERTY_LIST))
         session.login(session.get_session().email)
         return render.single_panel(title="Profile Change", body="success!")
示例#15
0
 def POST(self):
     # TODO: mover login para o model
     user = web.input().user
     password = web.input().password
     if session.login(user, password):
         raise web.seeother('/')
     else:
         return view.login()
示例#16
0
文件: site.py 项目: lazybios/pycms
 def POST(self):
     form = login_form()
     if not form.validates():
         return render.login(form)
     if session.login(form.d.username, form.d.password):
         raise web.seeother('/admin')
     else:
         session.set_flash('用户名或密码错误', 'error')
         raise web.seeother('/login')