This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
forked from willm0602/ThymeSaver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Registration.py
84 lines (73 loc) · 2.16 KB
/
Registration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from kivy.core import text
from kivy.core.window import Window
from kivy.lang import builder
from kivy.uix.boxlayout import BoxLayout
from kivymd.app import MDApp
from kivymd.font_definitions import theme_font_styles
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.button import MDFillRoundFlatButton
from kivymd.uix.label import MDLabel
from kivymd.uix.textfield import MDTextField, MDTextFieldRound
from DBHandler import DB
from User import User
REGISTRATION = '''
BoxLayout:
orientation: "vertical"
MDLabel:
text: "Register"
halign: "center"
theme_text_color: "Custom"
text_color: 0, 0.5, 0, 1
#username
MDTextField:
hint_text: "Username"
id: user
halign: "center"
valign: "middle"
color_mode: "primary"
mode: "rectangle"
hint_text_color: "black"
theme_text_color: "Custom"
text_color: 0, 0.5, 0, 1
#password
MDTextField:
hint_text: "Password"
id: password
halign: "center"
valign: "middle"
color_mode: "primary"
mode: "rectangle"
hint_text_color: "black"
theme_text_color: "Custom"
text_color: 0, 0.5, 0, 1
password: True
#email
MDTextField:
hint_text: "Email"
id: email
halign: "center"
valign: "middle"
color_mode: "primary"
mode: "rectangle"
hint_text_color: "black"
theme_text_color: "Custom"
text_color: 0, 0.5, 0, 1
#submit
MDFillRoundFlatButton:
id: "submit"
text: "Register"
font_size: "30"
color: (0, 0.5, 0)
halign: "center"
pos: self.parent.pos
on_release:
app.register(user.text,password.text, email.text)
'''
class RegisterApp(MDApp):
def register(self, username, password, email):
user = User(username,email,password)
query = f"INSERT INTO User VALUES('{username}', '{email}', PASSWORD('{password}'));"
DB.exec(query)
def build(self):
return builder.Builder.load_string(REGISTRATION)
RegisterApp().run()