예제 #1
0
파일: models.py 프로젝트: wax54/pizza-time
    def update_accessor(self):
        """updates a users accessor"""
        ACCESSOR_TIMEOUT_DAYS = 4
        
        accessor = User.create_unique_accessor()
        self.accessor = accessor

        expiration = make_date_time_from_now(days=ACCESSOR_TIMEOUT_DAYS)
        self.accessor_expiration = expiration

        db.session.add(self)
        db.session.commit()
        # unneccesary
        # #use bcrypt to hash the accessor
        # hashed = bcrypt.generate_password_hash(user.accessor)
        # # turn bytestring into normal (unicode utf8) string
        # hashed_utf8 = hashed.decode("utf8")

        return self.accessor
예제 #2
0
def login(email='', password=''):
    # successful login
    return {
        "token": hash(randint(100, 100000000)),
        "expiration": make_date_time_from_now(years=1)
    }
예제 #3
0
def re_auth(email, token):
    return {
        "token": hash(randint(100, 100000000)),
        "expiration": make_date_time_from_now(years=1)
    }
예제 #4
0
def token_expiry(email, token):
    return make_date_time_from_now(days=4)
예제 #5
0
DATE_FORMAT = "%a, %d %b %Y %H:%M:%S %Z"  # "Mon, 19 Apr 2021 00:00:00 GMT"

DEMO_DELIVERY = {
    "orders": [{
        "num": 43,
        "name": "Kassandra Meyers",
        "address": "12704 NE 88th Ln, Kirkland, WA 98033",
        "phone": "425-155-1443"
    }, {
        "num": 17,
        "name": "Gracy Williams",
        "address": "10035 127th Ave NE, Kirkland, WA 98033",
        "phone": "425-555-8972"
    }],
    "date":
    string_date_time(make_date_time_from_now().date()),
    "store":
    "1"
}

DEMO_SCHEDULES = [{
    "week_code":
    10121,
    "schedule": [{
        "start": string_date_time(make_date_time_from_now(hours=-1)),
        "end": string_date_time(make_date_time_from_now(hours=5)),
        "shift_type": "DR1"
    }, {
        "start":
        string_date_time(make_date_time_from_now(days=1, hours=-2)),
        "end":