Пример #1
0
    def get(self,company_id,*args,**kwargs):

        company_service = CompanyServices(self.db)
        user_services = UserServices(self.db)
        company = company_service.get_company_by_id(company_id)
        user = user_services.get_user_by_id(company.Fuser_id)
        self.echo('ops/company/company_edit.html',{'company':company,'user':user})
Пример #2
0
 def get(self):
     Fid = self.get_current_user().get('Fid')
     u_svr = UserServices(self.db)
     user = u_svr.get_user_by_id(Fid)
     return self.echo(
         'crm/login/user_info_edit.html',
         {'user': user},
         layout='crm/common/base.html')
Пример #3
0
    def post(self, user_id):
        uid_mct = self.get_current_user().get('Fid')
        pms = self.check_arg('permission', u'^[\d\w,]{1,512}$', '')
        kwargs = {
            'Fuser_mobi':
            self.check_arg('user_mobi', u'^\d{1,28}$'),
            'Fnick_name':
            self.check_arg('user_name', u'^[\u4e00-\u9fa5\d\w\s]{1,28}$'),
            # 'Fnick_name': self.check_arg('nick_name', u'^[\u4e00-\u9fa5\d\w\s]{1,28}$', ''),
            'Femail':
            self.check_arg('user_email', u'^[\w\d@.]{1,64}$', ''),
            "Fpermission":
            pms
        }
        pwd_srv = UserServices(self.db)
        _user_pwd = self.check_arg('user_pwd', u'^[\d\w]{1,28}$', '')
        if _user_pwd:
            _user = pwd_srv.get_user_by_id(user_id)
            kwargs['Fuser_pwd'] = pwd_srv.user_passed(_user_pwd, _user.Fuid)

        user_srv = CompanyUserServices(self.db)
        user_srv.edit_users(uid_mct, user_id, **kwargs)
        return self.write({'stat': 'ok', 'msg': ''})
Пример #4
0
    def post(self):
        res = self.check_args(
            Fbirthday='',
            Femail='',
            Fweixin='',
            Fweibo='',
            Fqq='',
            Fuser_pwd='',
        )
        if res:
            return self.write(Error(2000, res, "参数错误").__dict__)

        Fid = self.get_current_user().get('Fid')
        self.get_paras_dict()
        del self.qdict['_xsrf']
        user_srv = UserServices(self.db)
        if self.qdict['Fuser_pwd']:
            _user = user_srv.get_user_by_id(Fid)
            self.qdict['Fuser_pwd'] = user_srv.user_passed(
                self.qdict['Fuser_pwd'],
                _user.Fuid)
        user_srv.update_user(Fid, **self.qdict)
        return self.write({'stat': 'ok', 'msg': ''})