Esempio n. 1
0
    def handleLogin(self):
        employeedata = EmployeeData()

        try:

            user = employeedata.get_employee_by_username(
                self.username_lineedit.text())
            print(user.password)
            if user.password == self.password_lineedit.text():
                self.user = user
                self.accept()
            else:
                QtWidgets.QMessageBox.warning(self, 'Error',
                                              'Bad user or password')

        except NoResultFound:
            if self.username_lineedit.text() == "joe":
                joe = employeedata.add_employee('joe', 'p')
                joe = employeedata.update_employee(
                    joe.id, {
                        'email': '*****@*****.**',
                        'telephone': '800-999-9999',
                        'first_name': 'Joe',
                        'last_name': 'Smith',
                        'is_admin': True
                    })
            else:
                QtWidgets.QMessageBox.warning(self, 'Error',
                                              'Bad user or password')
Esempio n. 2
0
 def submit_change(self):
     '''
     If an employee submits a request that they forgot their password,
     a notification is sent to the admin. It is then the admin's job to change
     the employee's password and notify that employee outside of the system
     of that change.
     If the input email does not match the saved email, an error is thrown and 
     no password notification is sent.
     
     TODO: implement password change notifications
     '''
     employeedata = EmployeeData()
     try:
         user = employeedata.get_employee_by_username(
             self.username_lineedit.text())
         if user.email != self.email_lineedit.text(
         ) or self.email_lineedit == '':
             QtWidgets.QMessageBox.warning(self, 'Error',
                                           'Bad user or email')
         #TODO: NOTIFICATION
         self.accept()
     except NoResultFound:
         QtWidgets.QMessageBox.warning(self, 'Error', 'Bad user or email')
Esempio n. 3
0
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'viewprofile.ui'
#
# Created by: PyQt5 UI code generator 5.10
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets
import re

from backend.utils import EmployeeData
employee_data = EmployeeData()


class Ui_ViewProfile(object):
    def setupUi(self, ViewProfile):
        ViewProfile.setObjectName("ViewProfile")
        ViewProfile.resize(581, 391)
        ViewProfile.setGeometry(QtCore.QRect(230, 30, 581, 391))

        self.formLayoutWidget = QtWidgets.QWidget(ViewProfile)
        self.formLayoutWidget.setGeometry(QtCore.QRect(40, 40, 471, 181))
        self.formLayoutWidget.setObjectName("formLayoutWidget")
        self.employee_formLayout = QtWidgets.QFormLayout(self.formLayoutWidget)
        self.employee_formLayout.setContentsMargins(0, 0, 0, 0)
        self.employee_formLayout.setObjectName("employee_formLayout")
        self.first_name_label = QtWidgets.QLabel(self.formLayoutWidget)
        self.first_name_label.setObjectName("first_name_label")
        self.employee_formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.first_name_label)
        self.first_name_input = QtWidgets.QLineEdit(self.formLayoutWidget)
Esempio n. 4
0
from backend.models import init_db
from backend.utils import EmployeeData, RoomData, MeetingData, TimeSlotData, EmployeeMeetingData
import os
import datetime

dirname = os.path.dirname
os.remove(
    os.path.abspath(
        os.path.join(dirname(dirname(__file__)), "sqlalchemy_example.db")))

engine = init_db('sqlite:///sqlalchemy_example.db')

employee_data = EmployeeData()

joe = employee_data.add_employee('joe', 'p')
joe = employee_data.update_employee(
    joe.id, {
        'email': '*****@*****.**',
        'telephone': '800-999-9999',
        'first_name': 'Joe',
        'last_name': 'Smith',
        'is_admin': True
    })
Esempio n. 5
0
from backend.models import init_db
from backend.utils import EmployeeData, RoomData, MeetingData, TimeSlotData, EmployeeMeetingData
import os
import datetime

dirname = os.path.dirname
try:
    os.remove(
        os.path.abspath(
            os.path.join(dirname(dirname(__file__)), "scheduler.db")))
except:
    pass
engine = init_db('sqlite:///scheduler.db')

employee_data = EmployeeData()

joe = employee_data.add_employee('joe', 'p')
joe = employee_data.update_employee(
    joe.id, {
        'email': '*****@*****.**',
        'telephone': '800-999-9999',
        'first_name': 'Joe',
        'last_name': 'Smith',
        'is_admin': True
    })

jack = employee_data.add_employee('jack', 'p')
jack = employee_data.update_employee(
    jack.id, {
        'email': '*****@*****.**',
        'telephone': '800-999-9999',
Esempio n. 6
0
 def get_employees(self):
     employeedata = EmployeeData()
     return [e.username for e in employeedata.get_all_employees()]