Compare commits
2 commits
6d4717e471
...
ab92ecfb4a
Author | SHA1 | Date | |
---|---|---|---|
ab92ecfb4a | |||
83e44da330 |
3 changed files with 8 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -160,5 +160,5 @@ cython_debug/
|
|||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
config
|
||||
db
|
||||
config/*
|
||||
db/*
|
||||
|
|
10
dislocker.py
10
dislocker.py
|
@ -40,13 +40,13 @@ class Cert():
|
|||
|
||||
def register(self, username, userid):
|
||||
cursor = self.db.cursor()
|
||||
insert_sql = "INSERT INTO user_list (discord_username, discord_userid) VALUES (%s, %s);"
|
||||
insert_sql = "INSERT INTO user_list (discord_username, discord_userid) VALUES (?, ?);"
|
||||
cursor.execute(insert_sql, (username, userid))
|
||||
self.db.commit()
|
||||
|
||||
def get_username(self, username, password):
|
||||
cursor = self.db.cursor()
|
||||
get_sql = "SELECT * FROM web_auth WHERE username = %s AND password = %s "
|
||||
get_sql = "SELECT * FROM web_auth WHERE username = ? AND password = ? "
|
||||
cursor.execute(get_sql, (username, password))
|
||||
result = cursor.fetchall()
|
||||
print(result)
|
||||
|
@ -55,14 +55,8 @@ class Cert():
|
|||
elif result[0][1] == username and result[0][2] == password:
|
||||
return 0
|
||||
|
||||
class Web(flask.Flask):
|
||||
async def temp(self):
|
||||
print("")
|
||||
|
||||
|
||||
cert = Cert()
|
||||
print(cert.get_username("suti7", "0126"))
|
||||
|
||||
|
||||
bot_config_path = "./config/bot.json"
|
||||
if not os.path.isfile(bot_config_path):
|
||||
|
|
8
webui.py
8
webui.py
|
@ -1,6 +1,6 @@
|
|||
from flask import Flask, request, render_template, redirect, url_for
|
||||
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user
|
||||
import psycopg2
|
||||
import sqlite3
|
||||
|
||||
app = Flask(__name__, static_folder="./resource/")
|
||||
app.secret_key = 'your_secret_key'
|
||||
|
@ -9,17 +9,17 @@ login_manager.init_app(app)
|
|||
|
||||
class Cert():
|
||||
def __init__(self):
|
||||
self.db = psycopg2.connect("host=localhost dbname=dislocker user=suti7 password=testing")
|
||||
self.db = sqlite3.connect("host=localhost dbname=dislocker user=suti7 password=testing")
|
||||
|
||||
def register(self, username, userid):
|
||||
cursor = self.db.cursor()
|
||||
insert_sql = "INSERT INTO user_list (discord_username, discord_userid) VALUES (%s, %s);"
|
||||
insert_sql = "INSERT INTO user_list (discord_username, discord_userid) VALUES (?, ?)"
|
||||
cursor.execute(insert_sql, (username, userid))
|
||||
self.db.commit()
|
||||
|
||||
def login(self, username, password):
|
||||
cursor = self.db.cursor()
|
||||
get_sql = "SELECT * FROM web_auth WHERE username = %s AND password = %s "
|
||||
get_sql = "SELECT * FROM web_auth WHERE username = ? AND password = ? "
|
||||
cursor.execute(get_sql, (username, password))
|
||||
result = cursor.fetchall()
|
||||
print(result)
|
||||
|
|
Loading…
Reference in a new issue