mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
update plugin-password
This commit is contained in:
parent
51f8513292
commit
130ec8b811
2 changed files with 17 additions and 10 deletions
|
@ -10,7 +10,7 @@ COPY static ./static
|
|||
COPY requirements.txt main.py database.sqlite ./
|
||||
RUN apt update
|
||||
|
||||
# Install supervisords
|
||||
# Install supervisord
|
||||
RUN apt install -y supervisor
|
||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY config/cmd.sh /cmd.sh
|
||||
|
|
|
@ -3,17 +3,24 @@ from pydantic import BaseModel
|
|||
from api.model.user import User
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('/usr/src/app/database.sqlite', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
|
||||
def dict_factory(cursor, row):
|
||||
d = {}
|
||||
for idx, col in enumerate(cursor.description):
|
||||
d[col[0]] = row[idx]
|
||||
return d
|
||||
|
||||
def AppUpdateUser(user_name, password):
|
||||
sql = "UPDATE user SET password=" + password + " WHERE user_name=" + user_name
|
||||
cursor.execute(sql)
|
||||
conn = sqlite3.connect('database.sqlite')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("UPDATE user SET password=? WHERE user_name=?", ( password,user_name,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
def AppSearchUsers(user_type):
|
||||
sql = "SELECT * FROM user WHERE user_type=" + user_type
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
conn = sqlite3.connect('/usr/src/app/database.sqlite')
|
||||
conn.row_factory = dict_factory
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT user_name,password,nick_name FROM user WHERE user_type=?", (user_type,))
|
||||
rows = cursor.fetchone()
|
||||
conn.close()
|
||||
return rows
|
||||
|
|
Loading…
Reference in a new issue