예제 #1
0
def enter_username_to_block(message):
    username = message.text
    try:
        customer = Customer.construct(username)
        user.person.block_fan_id_card(customer)
        send(
            message, "The Fan ID Card {} was successfully blocked".format(
                customer.fan_id_card.id))
    except CustomerDoesNotExistError:
        send(
            message,
            "Customer with username \"{}\" does not exist. Please enter the username again"
            .format(username), enter_username_to_block)
예제 #2
0
def enter_password(message):
    password = message.text
    if PersonDAO.is_password_correct(user.username, password):
        user.password = password
        user.authenticated = True
        user.role = PersonDAO.get_role_by_username(user.username)
        if user.role == "customer":
            user.person = Customer.construct(user.username)
        elif user.role == "cashier":
            user.person = Cashier.construct(user.username)
        elif user.role == "organizer":
            user.person = Organizer.construct(user.username)
        send(
            message,
            "🟢 You have been successfully logged in as {} {} {} 🟢".
            format(user.role, user.person.first_name,
                   user.person.last_name), show)
    else:
        send(
            message,
            "The entered password is wrong. Enter correct username and password again",
            enter_username)
예제 #3
0
import hashlib
import re

import psycopg2

from dao.fan_id_card_dao import FanIDCardDAO
from domain.cashier import Cashier
from domain.customer import Customer
from domain.fan_id_card import FanIDCard
from domain.match import Match
from domain.organizer import Organizer
from domain.ticket import SingleTicket

customer = Customer.construct("mario")
organizer = Organizer.construct("cristiano")
cashier = Cashier.construct("slava")
# match = Match(None, "Dortmund", "Sevilla", "2021-03-10", organizer.username, "quarterfinal")
# organizer.add_match(match)
# new_customer = Customer("alexis", "alexis", "sanchez", 29, None)
# cashier.register(new_customer)


def encrypt_password(password):
    return hashlib.md5(password.encode()).hexdigest()


print(encrypt_password("james"))