def accept(self): if self.EditNew.text() == '' or self.EditConferm.text() == '': QMessageBox.about(self, 'Attenzione', codes.msg(code=309)) if self.EditNew.text() == self.EditConferm.text(): sql_query.Q(action='update_pwd', kwargs=[self.EditNew.text(), self._client]) self.hide() else: self.EditNew.clear() self.EditConferm.clear() QMessageBox.about(self, 'Attenzione', codes.msg(code=310))
def _save(self): conf = configparser.RawConfigParser() conf.read( os.path.join(os.path.dirname(os.path.abspath(__file__)), '../db.conf')) email_regex = re.compile(r"[^@]+@[^@]+\.[^@]+") if self.lineEditClient.text() == '' or \ self.lineEditName.text() == '' or \ self.lineEditEmail.text() == '' or \ self.lineEditReq.text() == '' or \ self.lineEditLic.text() == '' or \ not email_regex.match(self.lineEditEmail.text()): QMessageBox.about(self, 'Attenzione', codes.msg(code=413)) else: sql_query.Q(action='insert_lic', kwargs=[ self.lineEditClient.text(), self.lineEditName.text(), self.lineEditEmail.text(), self.dateEditActive.text(), self.dateEditExpire.text(), self.lineEditReq.text(), self.lineEditLic.text(), self.spinBoxQty.value() ]) if self.spinBoxQty.value() is 0: qty = 'Ilimitati' else: qty = str(self.spinBoxQty.value()) sender = base64.b64decode( conf['Mail']['sender'][2:-1]).decode('utf-8') recipient = self.lineEditEmail.text() ctx = 'Gentile Cliente,<br><br>Grazie per aver scelto il nostro prodotto Aron Proxy,<br>' ctx += 'nel seguito inviamo i dati per l\'attivazione della licenza.<br><br>' ctx += 'Cliente: %s<br>Nome: %s<br>Codice: %s<br>Licenza: %s<br>Quantita\' devices: %s<br><br>' \ 'Cordiali Saluti,<br><br>' \ 'Computer Time s.r.l' % \ (self.lineEditClient.text(), self.lineEditName.text(), self.lineEditReq.text(), self.lineEditLic.text(), qty) msg = MIMEMultipart('alternative') msg['Subject'] = u'Computer Time :: Licenza per Aron Proxy' msg['From'] = sender msg['To'] = recipient message = MIMEText(ctx, 'html') msg.attach(message) s = smtplib.SMTP( base64.b64decode(conf['Mail']['server'][2:-1]).decode('utf-8'), 25) s.login( base64.b64decode(conf['Mail']['user'][2:-1]).decode('utf-8'), base64.b64decode( conf['Mail']['password'][2:-1]).decode('utf-8')) s.sendmail(sender, recipient, msg.as_string()) s.quit() self._loadtable()
def closeEvent(self, event): if self._want_to_close: super(DialogLogin, self).closeEvent() else: event.ignore() sql_query.Q(action='log', kwargs=[self.EditLogin.text(), codes.msg(code=404) + self.EditLogin.text()]) qApp.exit(0)
def accept(self): if self.EditDialog.text() == '': QMessageBox.about(self, 'Attenzione', codes.msg(code=308)) else: if self.EditDialog.isReadOnly() is False: self._save() sql_query.Q(action='new_hw', kwargs=[self.EditDialog.text(), self._client]) self.hide()
def accept(self): if self.EditDialog.text() == '': QMessageBox.about(self, 'Attenzione', codes.msg(code=308)) else: if self._item == 'LAN' or self._item == 'WAN': if iptools.ipv4.validate_ip(self.EditDialog.text()) is True: sql_query.Q(action='new_line', kwargs=[self._hardware, self._item, self.EditDialog.text(), self._client]) self.hide() return else: QMessageBox.about(self, 'Attenzione', codes.msg(code=311)) return sql_query.Q(action='new_line', kwargs=[self._hardware, self._item, self.EditDialog.text(), self._client]) self.hide()
def _save(self): try: sql_query.Q(action='save_it_new', kwargs=[self.EditDialog.text()]) self.EditDialog.setReadOnly(True) self.btItSave.setDisabled(True) self.EditDialog.setText('') self.buttonBox.setDisabled(False) self.load_table() except: QMessageBox.about(self, 'Attenzione', codes.msg(code=307))
def accept(self): if self.EditLogin.text() == '' or self.EditPass.text() == '': QMessageBox.about(self, 'Attenzione', codes.msg(code=114)) else: try: access = sql_query.Q(action='login', kwargs=[self.EditLogin.text()]) if len(access) is 0: self.EditLogin.clear() self.EditPass.clear() self.EditLogin.setFocus() elif bcrypt.hashpw(str(self.EditPass.text()).encode('utf-8'), str(access[0][1]).encode('utf-8')) == str(access[0][2]).encode('utf-8'): self._login = self.EditLogin.text() sql_query.Q(action='log', kwargs=[self.EditLogin.text(), codes.msg(code=115)]) self._access = self.hide() else: self.EditLogin.clear() self.EditPass.clear() self.EditLogin.setFocus() sql_query.Q(action='log', kwargs=[self.EditLogin.text(), codes.msg(code=404 + self.EditLogin.text())]) except: QMessageBox.about(self, 'Attenzione', codes.msg(code=401))
def _save(self): try: if self.modify == 'False': sql_query.Q(action='save_new_user', kwargs=[ self.EditDialog.text(), self.EditDialogPwd.text(), self.checkBox.checkState() ]) else: sql_query.Q(action='update_user', kwargs=[ self.EditDialog.text(), self.checkBox.checkState() ]) self.modify = 'False' self.EditDialog.setText('') self.EditDialogPwd.setText('') self.EditDialog.setReadOnly(True) self.EditDialogPwd.setReadOnly(True) self.load_table() self.btSave.setDisabled(True) except: QMessageBox.about(self, 'Attenzione', codes.msg(code=307))
def keyPressEvent(self, event): if event.key() == Qt.Key_Return: self.accept() if event.key() == Qt.Key_Escape: sql_query.Q(action='log', kwargs=[self.EditLogin.text(), codes.msg(code=404) + self.EditLogin.text()]) qApp.exit(0)