Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- conn = sqlite3.connect('HandwritingRecognition.db')
- c = conn.cursor()
- def Create():
- c.execute('CREATE TABLE IF NOT EXISTS Users(FirstName TEXT, Surname TEXT, Username TEXT, Passwrd TEXT)')
- def Data_Entry(self):
- FirstName = self.ids.FirstName.text
- Surname = self.ids.Surname.text
- Username = FirstName+Surname
- Passwrd = self.ids.Passwrd.text
- c.execute("INSERT INTO Users (FirstName,Surname,Username,Passwrd) VALUES(?,?,?,?)",(FirstName,Surname,Username,Passwrd))
- conn.commit()
- def Find_User(self):
- finduser = ('SELECT * FROM Users WHERE Username = ? AND Passwrd = ?')
- c.execute(finduser,[(self.ids.Username.text),(self.ids.Passwrd.text)])
- data = c.fetchall()
- if data:
- return True
- else:
- return False
- def Delete_User(USER):
- c.execute("DELETE FROM Users WHERE Username = ?",(USER,))
- conn.commit()
- <RootWidget>:
- id: Main
- Login_Screen:
- id: login
- name: "Login_Screen"
- Change_Password:
- id: ChangePass
- name: 'Change_Password'
- Login_Failed:
- id: Failed
- name: "Login_Failed"
- Login_Successful:
- id: Success
- name: 'Login_Successful'
- Registration_Screen:
- id: register
- name: 'Registration_Screen'
- <Login_Screen>:
- GridLayout:
- rows:3
- cols:2
- Label:
- text: "Username:"
- font_size: 20
- TextInput:
- id: Username
- multiline: False
- hint_text: 'Enter your Username'
- Label:
- text: "Password"
- font_size: 20
- TextInput:
- id: Passwrd
- multiline: False
- hint_text: 'Enter your Password'
- password: True
- Button:
- text: "Register"
- background_color: (1,0,0,1)
- on_press: root.registration()
- Button:
- text: "Sign In"
- on_press: root.Login()
- <Registration_Screen>:
- GridLayout:
- rows:4
- cols:2
- Label:
- text: 'First Name:'
- font_size: 20
- TextInput:
- id: FirstName
- multiline: False
- hint_text: 'Enter your First Name'
- Label:
- text: 'Surname'
- font_size: 20
- TextInput:
- id: Surname
- multiline: False
- hint_text: 'Enter your Surname'
- Label:
- text: 'Password'
- font_size: 20
- TextInput:
- id: Passwrd
- multiline: False
- hint_text: 'Enter your Password'
- password: False
- Button:
- text: "Create Account"
- on_press: root.MainScreen()
- <Change_Password>
- FloatLayout:
- Label:
- text: 'Change Password'
- pos_hint: {"center_x":0.5, "y":0.75}
- font_size: '25sp'
- size_hint: 0.5,0.25
- Label:
- text:'Old Password:'
- pos_hint: {"x":0.2, "y":0.6}
- font_size: '25sp'
- size_hint: 0.3,0.1
- TextInput:
- pos_hint: {"x": 0.5,"y": 0.6}
- size_hint: 0.3,0.1
- id: OldPass
- multiline: False
- password: True
- <Login_Successful>:
- FloatLayout:
- Label:
- text: 'Main Menu'
- pos_hint: {"center_x":0.5, "y":0.75}
- font_size: '25sp'
- size_hint: 0.5,0.25
- Button:
- text: 'Handwriting Recognition'
- pos_hint: {"center_x":0.5, "y":0.5}
- size_hint: 0.44,0.2
- Button:
- text: 'Change Password'
- pos_hint: {"center_x":0.38, "y":0.27}
- size_hint: 0.2,0.2
- on_press: root.ChangePassword()
- Button:
- text: 'Delete Account'
- pos_hint: {"center_x":0.38, "y":0.05}
- size_hint: 0.2,0.2
- on_press: root.DeleteAccount()
- Button:
- text: 'Log Out'
- pos_hint: {"center_x":0.62, "y":0.05}
- size_hint: 0.2,0.2
- on_press: root.MainScreen()
- <Login_Failed>:
- BoxLayout:
- orientation: "vertical"
- Label:
- text: "Login Failed"
- Button:
- text: "Try again"
- on_press: root.MainScreen()
- import sqlite3
- conn = sqlite3.connect('HandwritingRecognition.db')
- c = conn.cursor()
- def Create():
- c.execute('CREATE TABLE IF NOT EXISTS Users(FirstName TEXT, Surname TEXT, Username TEXT, Passwrd TEXT)')
- def Data_Entry(self):
- FirstName = self.ids.FirstName.text
- Surname = self.ids.Surname.text
- Username = FirstName+Surname
- Passwrd = self.ids.Passwrd.text
- c.execute("INSERT INTO Users (FirstName,Surname,Username,Passwrd) VALUES(?,?,?,?)",(FirstName,Surname,Username,Passwrd))
- conn.commit()
- def Find_User(self):
- finduser = ('SELECT * FROM Users WHERE Username = ? AND Passwrd = ?')
- c.execute(finduser,[(self.ids.Username.text),(self.ids.Passwrd.text)])
- data = c.fetchall()
- if data:
- return True
- else:
- return False
- def Delete_User(USER):
- c.execute("DELETE FROM Users WHERE Username = ?",(USER,))
Add Comment
Please, Sign In to add comment