예제 #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
파일: home.py 프로젝트: Magic347/rhinoceros
 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('/')
예제 #4
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('/')
예제 #5
0
파일: account.py 프로젝트: Paaskehare/MLSS
 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('/')
예제 #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)
        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, '/static/public/img/default_48x48.jpg')
            id = users.get_user_by_email(f.d.email).id
            users.update_user_by_id(
                id,
                douban_id=id
            )

            if not users.is_user_exist_in__permission(id):
                db.insert('_permission', douban_id = id, rights = 1)
            if users.is_user_profile_exist(id):
                users.update_profile(id, city = '上海', bio = '')
            else:
                users.insert_profile(id, city = '上海', bio = '')

            session.login(f.d.email)
            user.is_logged = False # 虽然注册了, 但是还要等邮件确认
            user.douban_id = id

            token = md5.md5(time.ctime() + f.d.email).hexdigest()
            try:
                email_templates.msg_new_user_email(user, f.d.email, token)
                #保存记录到数据库
                users.save_confirm_email(f.d.email, user.id, token)
                #跳转到邮件发送成功页面
                return web.seeother('/welcome/'+ f.d.username +'/send_email_feedback?status=succesful')
            except Exception, e:
                print 'error--------, send email feedback ------------------'
                print e
                return web.seeother('/welcome/'+ f.d.username +'/send_email_feedback?status=failed')
예제 #7
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('/')
예제 #8
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')
예제 #9
0
def add_defaut_users():
    from app.models import users
    dft_pwd = '123456'
    users.create_account('*****@*****.**', '123456', 5)
    users.create_account('*****@*****.**', '123456', 5)

    users.create_account('*****@*****.**', '123456', 1)
    users.create_account('*****@*****.**', '123456', 1)
예제 #10
0
파일: users.py 프로젝트: tschertel/Synergie
 def POST(self):
     i = web.input()
     web.header('Cache-Control', 'no-cache, no-store, must-revalidate')
     web.header('Pragma', 'no-cache')
     web.header('Expires', '-1')
     # sorting and paging parameters
     if i.get("action") == "list":
         return users.list_users(i.get("email"), i.get("is_active"), i.get("jtStartIndex"), i.get("jtPageSize"), i.get("jtSorting"))
     elif i.get("action") == "update":
         return users.update_user(i)
     elif i.get("action") == "new":
         return users.create_account(i)