コード例 #1
0
 def post(self, id, ck):
     current_user_id = self.current_user_id
     current_user = self.current_user
     if current_user_id:
         password = self.get_argument('password', None)
         if password:
             user_id = self.handler_verify(id, ck, True)
             if current_user_id == user_id:
                 if current_user.state == ZSITE_STATE_APPLY:
                     current_user.state = ZSITE_STATE_ACTIVE
                     current_user.save()
                 user_password_new(user_id, password)
                 return self.render(password=password)
             else:
                 return
         else:
             return self.get(id, ck)
     self.redirect('/')
コード例 #2
0
ファイル: verify.py プロジェクト: xqk/42qu_github_mirror
 def post(self, id, ck):
     current_user_id = self.current_user_id
     current_user = self.current_user
     if current_user_id:
         password = self.get_argument('password', None)
         if password:
             user_id = self.handler_verify(id, ck, True)
             if current_user_id == user_id:
                 if current_user.state == ZSITE_STATE_APPLY:
                     current_user.state = ZSITE_STATE_ACTIVE
                     current_user.save()
                 user_password_new(user_id, password)
                 return self.render(password=password)
             else:
                 return
         else:
             return self.get(id, ck)
     self.redirect('/')
コード例 #3
0
 def post(self):
     user_id = self.current_user_id
     password0 = self.get_argument('password0', None)
     password = self.get_argument('password', None)
     password2 = self.get_argument('password2', None)
     success = None
     error_password = None
     if all((password0, password, password2)):
         if password == password2:
             if user_password_verify(user_id, password0):
                 user_password_new(user_id, password)
                 success = True
             else:
                 error_password = '******' % escape(
                     mail_by_user_id(user_id))
         else:
             error_password = '******'
     else:
         error_password = '******'
     self.render(success=success, error_password=error_password)
コード例 #4
0
ファイル: i.py プロジェクト: immissile/42qu_github_mirror
 def post(self):
     user_id = self.current_user_id
     password0 = self.get_argument("password0", None)
     password = self.get_argument("password", None)
     password2 = self.get_argument("password2", None)
     success = None
     error_password = None
     if all((password0, password, password2)):
         if password == password2:
             if user_password_verify(user_id, password0):
                 user_password_new(user_id, password)
                 success = True
             else:
                 error_password = '******' % escape(
                     mail_by_user_id(user_id)
                 )
         else:
             error_password = "******"
     else:
         error_password = "******"
     self.render(success=success, error_password=error_password)
コード例 #5
0
    def post(self):

        current_user = self.current_user
        current_user_id = current_user.id
        result = {}
        error = {}


        name = self.get_argument('name', None)
        if not name:
            error['name'] = '请输入姓名'

        sex = None
        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            sex = self.get_argument('sex', '0')
            if not(sex and int(sex) in (1, 2)):
                error['sex'] = '请选择性别'

        password = None
        if not UserPassword.get(current_user_id):
            password = self.get_argument('password', None)
            if not password:
                error['password'] = '******'

        if not error:
            if password:
                user_password_new(current_user_id, password)

            if sex:
                user_info_new(current_user_id, sex=sex)

            current_user.name = name
            current_user.save()
        else:
            result['error'] = error

        self.finish(result)
コード例 #6
0
ファイル: newbie.py プロジェクト: xqk/42qu_github_mirror
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not (sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
            sex=sex,
            name=name,
            errtip=errtip,
            zsite_list=zsite_list,
        )
コード例 #7
0
    def post(self):
        name = self.get_argument('name', None)
        sex = self.get_argument('sex', '0')
        errtip = Errtip()
        current_user = self.current_user
        current_user_id = current_user.id

        info = _UserInfo.mc_get(current_user_id)
        if not (info and info.sex):
            if not(sex and int(sex) in (1, 2)):
                errtip.sex = '请选择性别'

        password = UserPassword.get(current_user_id)
        if not password:
            password = self.get_argument('password', None)
            if not password:
                errtip.password = '******'
            else:
                user_password_new(current_user_id, password)

        if name:
            current_user.name = name
            current_user.save()

        if not errtip:
            path = '/i/guide'
            user_info_new(current_user.id, sex=sex)
            return self.redirect(path)

        id_list = SHOW_LIST
        zsite_list = filter(bool, Zsite.mc_get_list(id_list))
        return self.render(
                   sex=sex,
                   name=name,
                   errtip=errtip,
                   zsite_list=zsite_list,
               )