#!/usr/bin/python3
# -*- coding: utf-8 -*
# Copyright (C) 2017 Tetras Libre <contact@Tetras-Libre.fr>
# Author: Beniamine, David <David.Beniamine@Tetras-Libre.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from zxcvbn import zxcvbn
from dateutil.parser import parse
import getpass
from test_pass import test_pass

# Read password
passwd = getpass.getpass("Merci d'entrer un mot de passe qui ne sera pas affiché\n")

word = "a"
user_inputs = []
while word != "":
    word = input("Veuillez entrer un mot d'aide ou une date au format jj/mm/yyyy pour le système ou tappez [entrer]"
                 "pour arrêter\n")
    if word != "":
        try:
            date = parse(word)
            words = [date.day]
            words.append(date.month)
            words.append(date.year)
        except:
            words = [word]
        finally:
            for word in words:
                user_inputs.append(word)

# TODO call wrapper
    lines = test_pass(passwd, user_inputs)
for line in lines:
    print(line)