Example #1
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(user_id, self.current_user.name, mail,
                                CID_VERIFY_LOGIN_MAIL)
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
Example #2
0
    def post(self):
        errtip = Errtip()
        user_id = self.current_user_id
        user = self.current_user

        password = self.get_argument('password', None)
        mail = self.get_argument('mail', None)
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮件格式不正确'

        if not password:
            errtip.password = '******'
        elif not user_password_verify(user_id, password):
            errtip.password = '******'
            password = ''

        if not errtip:
            from model.user_mail import user_mail_new, user_mail_by_state, MAIL_VERIFIED, user_mail_active_by_user
            if mail in user_mail_by_state(user_id, MAIL_VERIFIED):
                user_mail_active_by_user(user, mail)
                return self.redirect('/i/account/mail/success')

            if user_mail_new(user_id, mail):
                verify_mail_new(
                    user_id, self.current_user.name, mail, CID_VERIFY_LOGIN_MAIL
                )
            else:
                errtip.mail = '该邮箱已经注册'

        self.render(mail=mail, errtip=errtip, password=password)
Example #3
0
 def get(self, id, ck):
     user_id, cid = verifyed(id, ck, delete=False)
     if user_id and CID_VERIFY_LOGIN_MAIL == cid:
         user = self.current_user
         user_mail_active_by_user(user)
         self.redirect('%s/i/account/mail/success'%user.link)
     else:
         self.redirect('/')
Example #4
0
 def get(self, id, ck):
     user_id, cid = verifyed(id, ck, delete=False)
     if user_id and CID_VERIFY_LOGIN_MAIL == cid:
         user = self.current_user
         user_mail_active_by_user(user)
         self.redirect('%s/i/account/mail/success' % user.link)
     else:
         self.redirect('/')
Example #5
0
    def get(self, id, ck):
        user_id = self.handler_verify(id, ck)
        if user_id:
            user = Zsite.mc_get(user_id)
            if user.state == ZSITE_STATE_APPLY or user.state == ZSITE_STATE_NO_PASSWORD:
                user.state = ZSITE_STATE_ACTIVE
                user_mail_active_by_user(user)
                user.save()
            self.__dict__['_current_user'] = user

            redirect = self.get_argument('next', '%s/i/guide'%user.link)

            if redirect:
                return self.redirect(redirect)
Example #6
0
    def get(self, id, ck):
        user_id = self.handler_verify(id, ck)
        if user_id:
            user = Zsite.mc_get(user_id)
            if user.state == ZSITE_STATE_APPLY or user.state == ZSITE_STATE_NO_PASSWORD:
                user.state = ZSITE_STATE_ACTIVE
                user_mail_active_by_user(user)
                user.save()
            self.__dict__['_current_user'] = user

            redirect = self.get_argument('next', '%s/i/guide' % user.link)

            if redirect:
                return self.redirect(redirect)