Exemplo n.º 1
0
 def post(self):
     act = self.get_argument("nick")
     mail = self.get_argument("email")
     psw = self.get_argument("password")
     print psw
     psw = sha224(psw).hexdigest()
     num = random.randint(1, 10)
     img = "/static/img/common/avt"+str(num)+".jpg"
     reg_time = time.strftime("%Y-%m-%d %X", time.localtime())
     uid = 0
     while(1):
         uid = random.randint(1000000, 10000000)
         chk_sql = "select * from user where uid=%d" % uid
         rt = self.db.get(chk_sql)
         if not rt:
             break
     code = md5(str(uid)+reg_time).hexdigest()
     sql = ("insert into user(uid,account,email,password,img,"
            "time,code) values ('%d','%s','%s','%s','%s','%s',"
            "'%s')") % (uid, act, mail, psw, img, reg_time, code)
     msg = self.render_string("register1.0beta/config_email.htm",
                              act=act, co=code)
     sub = "请完成账号激活"
     send(options.noreply_account, mail, sub, msg)
     self.db.execute(sql)
     left, right = mail.split('@')
     rlft, rght = right.split('.')
     if rlft == "gmail":
         right = "google."+rght
     mailpath = "mail."+right
     #self.set_secure_cookie("_yoez_uid",str(uid),expires_days=7)
     self.render('register1.0beta/register-2.html', actname=act,
                 mailpath=mailpath, code=code)
Exemplo n.º 2
0
 def get(self):
     code = self.get_argument('code')
     user_sql = "select * from user where code='%s'" % code
     rt = self.db.get(user_sql)
     if not rt:
         msg = 'send error!pleae contact Customer Services.'
         kwargs = dict(status=0, msg=msg)
         return self.write()
     msg = self.render_string("register1.0beta/config_email.htm",
                              act=rt.account, co=code)
     sub = "请完成账号激活"
     send(options.noreply_account, rt.email, sub, msg)
     self.write(dict(status=1, msg='go to email and for your active.'))
Exemplo n.º 3
0
 def get(self):
     code = self.get_argument('code')
     user_sql = "select * from user where code='%s'" % code
     rt = self.db.get(user_sql)
     if not rt:
         msg = 'send error!pleae contact Customer Services.'
         kwargs = dict(status=0, msg=msg)
         return self.write()
     msg = self.render_string("register1.0beta/config_email.htm",
                              act=rt.account,
                              co=code)
     sub = "请完成账号激活"
     send(options.noreply_account, rt.email, sub, msg)
     self.write(dict(status=1, msg='go to email and for your active.'))
Exemplo n.º 4
0
 def post(self):
     act = self.get_argument("nick")
     mail = self.get_argument("email")
     psw = self.get_argument("password")
     print psw
     psw = sha224(psw).hexdigest()
     num = random.randint(1, 10)
     img = "/static/img/common/avt" + str(num) + ".jpg"
     reg_time = time.strftime("%Y-%m-%d %X", time.localtime())
     uid = 0
     while (1):
         uid = random.randint(1000000, 10000000)
         chk_sql = "select * from user where uid=%d" % uid
         rt = self.db.get(chk_sql)
         if not rt:
             break
     code = md5(str(uid) + reg_time).hexdigest()
     sql = ("insert into user(uid,account,email,password,img,"
            "time,code) values ('%d','%s','%s','%s','%s','%s',"
            "'%s')") % (uid, act, mail, psw, img, reg_time, code)
     msg = self.render_string("register1.0beta/config_email.htm",
                              act=act,
                              co=code)
     sub = "请完成账号激活"
     send(options.noreply_account, mail, sub, msg)
     self.db.execute(sql)
     left, right = mail.split('@')
     rlft, rght = right.split('.')
     if rlft == "gmail":
         right = "google." + rght
     mailpath = "mail." + right
     #self.set_secure_cookie("_yoez_uid",str(uid),expires_days=7)
     self.render('register1.0beta/register-2.html',
                 actname=act,
                 mailpath=mailpath,
                 code=code)