Ejemplo n.º 1
0
    def post(self):
        form = account_forms.account_update_form()
        if not form.validates(source=self.get_params()):
            return self.render("base_form.html", form=form)

        account = self.db.query(models.TrAccount).get(form.d.account_number)
        account.ip_address = form.d.ip_address
        account.install_address = form.d.install_address
        account.user_concur_number = form.d.user_concur_number
        account.bind_mac = form.d.bind_mac
        account.bind_vlan = form.d.bind_vlan
        account.account_desc = form.d.account_desc
        if form.d.new_password:
            account.password = self.aes.encrypt(form.d.new_password)

        self.add_oplog(u'修改上网账号信息:%s' % (account.account_number))
        self.db.commit()
        self.redirect(self.detail_url_fmt(account.account_number))
Ejemplo n.º 2
0
 def get(self):
     account_number = self.get_argument("account_number",None)
     account = self.db.query(models.TrAccount).get(account_number)
     form = account_forms.account_update_form()
     form.fill(account)
     self.render("base_form.html", form=form)