def __init__(self, master, username):
        tk.Frame.__init__(self, master)

        self.master = master
        for widget in self.master.winfo_children():
            widget.destroy()

        self.username = username

        self.database = database.Database("password.db")
        self.master.title("Password Manager: Lister les mots de passe")
        self.master.geometry("900x450+300+100")

        self.frame = tk.Frame(self.master, width=900, height=450)
        self.frame.pack()

        home_btn = tk.Button(self.frame,
                             text="Accueil",
                             command=self.back_home)
        home_btn.pack(side=tk.TOP)

        self.site_label = tk.Label(self.frame, text="")
        self.pseudo_label = tk.Label(self.frame, text="")
        self.password_label = tk.Label(self.frame, text="")

        self.gen_info()
        self.gen_tree_view()
Exemple #2
0
    def __init__(self, master, username):
        self.master = master

        for widget in self.master.winfo_children():
            widget.destroy()

        self.database = database.Database("password.db")
        self.username = self.database.print_by_user(username)
        if not self.username:
            sys.exit(-1)
        self.pseudo = self.username[1]

        tk.Frame.__init__(self, master)

        self.master.title("Password Manager: Home")
        self.master.geometry("900x450+300+100")

        self.main_frame = tk.Frame(self.master, width=900, height=150)
        self.img_frame = tk.Frame(self.master, width=900, height=300)

        self.main_frame.place(rely=0, relheight=0.5, relwidth=1)
        self.img_frame.place(rely=0.5, relheight=0.5, relwidth=1)

        self.add_canv = tk.Canvas(self.img_frame, width=300, height=300)
        self.add_canv.pack(side=tk.LEFT)

        self.list_canv = tk.Canvas(self.img_frame, width=300, height=300)
        self.list_canv.pack(side=tk.LEFT)

        self.search_canv = tk.Canvas(self.img_frame, width=300, height=300)
        self.search_canv.pack(side=tk.LEFT)

        self.gen_main()
        self.gen_btn()
        self.gen_icon()
Exemple #3
0
    def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.master = master
        self.database = database.Database("password.db")

        for widget in self.master.winfo_children():
            widget.destroy()

        self.master.title("Password Manager: Créer un compte")
        self.master.geometry("900x450+300+100")

        self.main_frame = tk.Frame(self.master, width=900, height=450)
        self.main_frame.pack()

        self.error_lab = tk.Label(self.master, text="")

        self.gen_form()
Exemple #4
0
    def __init__(self, master, username):
        tk.Frame.__init__(self, master)

        self.master = master
        for widget in self.master.winfo_children():
            widget.destroy()
        self.username = username
        self.database = database.Database("password.db")

        self.master.title("Password Manager: Chercher un mot de passe")
        self.master.geometry("900x450+300+100")

        self.frame = tk.Frame(self.master, width=900, height=450)
        self.frame.pack()

        home_btn = tk.Button(self.frame,
                             text="Accueil",
                             command=self.back_home)
        home_btn.pack(side=tk.TOP)

        self.app_frame = tk.Frame(self.frame, width=450, height=250)
        self.app_frame.pack(side=tk.LEFT, fill=tk.X)

        self.user_frame = tk.Frame(self.frame, width=450, height=250)
        self.user_frame.pack(side=tk.RIGHT)

        self.result_frame = tk.Frame(self.master, width=900, height=200)
        self.result_frame.pack()

        self.app_str = tk.StringVar()
        self.pseudo_str = tk.StringVar()

        self.app_entry = tk.Entry(self.app_frame,
                                  width=30,
                                  textvariable=self.app_str)
        self.pseudo_entry = tk.Entry(self.user_frame,
                                     width=30,
                                     textvariable=self.pseudo_str)

        self.result_label = tk.Label(self.result_frame)

        self.frame.bind_all('<Return>', self.search)

        self.gen_form_search_by_app()
        self.gen_form_search_by_user()
    def __init__(self, master, username):
        tk.Frame.__init__(self, master)

        self.master = master
        self.username = username

        self.database = database.Database("password.db")

        self.master.title("Password Manager: Ajouter des Mots de passe")
        self.master.geometry("900x450+300+100")

        self.frame = tk.Frame(self.master, width=900, height=450)
        self.frame.pack()

        home_btn = tk.Button(self.frame,
                             text="Accueil",
                             command=self.back_home)
        home_btn.pack(side=tk.TOP)

        self.csv_frame = tk.Frame(self.frame, width=450, height=450)
        self.csv_frame.pack(side=tk.LEFT, fill=tk.X)

        self.line_frame = tk.Frame(self.frame, width=450, height=450)
        self.line_frame.pack()

        self.file_state = tk.Label(self.csv_frame, text="")
        self.line_state = tk.Label(self.line_frame, text="")

        self.app_str = tk.StringVar()
        self.user_str = tk.StringVar()
        self.pwd_str = tk.StringVar()

        self.app_entry = tk.Entry(self.line_frame, textvariable=self.app_str)
        self.user_entry = tk.Entry(self.line_frame, textvariable=self.user_str)
        self.pwd_entry = tk.Entry(self.line_frame,
                                  show="*",
                                  textvariable=self.pwd_str)

        self.gen_csv()
        self.gen_inline()
Exemple #6
0
    def __init__(self, master):
        self.database = database.Database("password.db")

        self.master = master
        for widget in self.master.winfo_children():
            widget.destroy()

        tk.Frame.__init__(self, master)

        self.master.title("Password Manager: Login")
        self.master.geometry("900x450+300+100")

        self.login_frame = tk.Frame(self.master, width=900, height=200)
        self.login_frame.pack(side=tk.TOP, fill=tk.X)

        self.signup_frame = tk.Frame(self.master, width=900, height=250)
        self.signup_frame.pack(fill=tk.X)

        tk.Button(self.signup_frame,
                  text="Enregistrer un compte",
                  width=30,
                  command=self.create_user).pack(pady=(75, 0))

        self.login_window()
Exemple #7
0
class Login(tk.Frame):

    database = db.Database()
    frame_bg_color = "#F0B649"
    btn_bg_color = "#4892F0"

    def __init__(self, master):
        self.master = master
        tk.Frame.__init__(self, self.master)

        for widget in self.master.winfo_children():
            widget.destroy()

        self.master.geometry("900x500+500+200")
        self.master.title("Accueil")
        self.master.configure(background="#4892F0")

        btn_font = font.Font(family='Helvetica',
                             name='myFont',
                             size=12,
                             weight='bold')

        self.frame = tk.Frame(self.master,
                              width=900,
                              height=500,
                              bg=Login.frame_bg_color)
        self.frame.pack(pady=(75, 20))
        self.frame.focus_set()

        tk.Label(
            self.frame,
            text=
            "Bienvenu(e)\n Veuillez vous connecter pour accéder à vos comptes",
            bg=Login.frame_bg_color).pack(pady=(30, 0))

        self.email_var = tk.StringVar()
        tk.Label(self.frame,
                 text="Entrez votre email: ",
                 bg=Login.frame_bg_color).pack(pady=(75, 0))
        self.entry_email = tk.Entry(self.frame,
                                    textvariable=self.email_var,
                                    width=30)
        self.entry_email.insert(0, '*****@*****.**')
        self.entry_email.pack(pady=(0, 20))

        self.password_var = tk.StringVar()
        tk.Label(self.frame,
                 text="Entrez votre mot de passe: ",
                 bg=Login.frame_bg_color).pack(pady=(5, 0))
        self.entry_pwd = tk.Entry(self.frame,
                                  textvariable=self.password_var,
                                  width=30,
                                  show='*')
        self.entry_pwd.pack(pady=(0, 50))

        self.connect_btn = tk.Button(self.frame,
                                     text="Se connecter",
                                     command=self.connect,
                                     bg=Login.btn_bg_color,
                                     fg=Login.frame_bg_color,
                                     font=btn_font,
                                     width=30)
        self.connect_btn.pack(side=tk.LEFT)

        self.signup_btn = tk.Button(self.frame,
                                    text="Ouvrir un compte",
                                    command=self.signin,
                                    bg=Login.btn_bg_color,
                                    fg=Login.frame_bg_color,
                                    font=btn_font,
                                    width=30)
        self.signup_btn.pack(side=tk.RIGHT)

        self.entry_email.bind('<Button-1>', self.clean_entry)
        self.frame.bind_all('<Return>', self.connect)

        self.connect_btn.bind('<Enter>',
                              func=lambda e, button=self.connect_btn: self.
                              hover(button=button, event=e))
        self.connect_btn.bind('<Leave>',
                              func=lambda e, button=self.connect_btn: self.
                              unhover(button=button, event=e))

        self.signup_btn.bind('<Enter>',
                             func=lambda e, button=self.signup_btn: self.hover(
                                 button=button, event=e))
        self.signup_btn.bind('<Leave>',
                             func=lambda e, button=self.signup_btn: self.
                             unhover(button=button, event=e))

    def hover(self, button, event):
        button.config(activebackground=Login.frame_bg_color)
        button.config(activeforeground=Login.btn_bg_color)

    def unhover(self, button, event):
        button.config(activebackground=Login.frame_bg_color)
        button.config(activeforeground=Login.btn_bg_color)

    def clean_entry(self, event=None):
        self.entry_email.delete(0, tk.END)

    def valid_email(self, email):
        return bool(re.search(r"^[\w\.\+\-]+\@[\w]+\.[a-z]{2,3}$", email))

    def connect(self, event=None):
        email = self.email_var.get()
        pwd = self.password_var.get()
        error_msg = "Attention l'email n'est pas au bon format."

        email_ok = self.valid_email(email)
        if email_ok:
            p = Login.database.check_person_exist(email, pwd)
            if not p:
                showerror("Erreur",
                          "Nous n'avons pas pu trouver votre compte.")
                return
            self.frame = home.Home(self.master, p, Login.database)
        else:
            showerror("Erreur", error_msg)
            self.clean_entry()
            self.entry_pwd.delete(0, tk.END)

    def signin(self):
        signin.SignIn(self.master, Login.database)
Exemple #8
0
def main():
    datab = db.Database()
    datab.init_db()
    application = app.App()
    application.mainloop()
    sys.exit(1)