ソースを参照

Can now register user

https
jakobsn 6年前
コミット
8718575bbb
4個のファイルの変更8行の追加7行の削除
  1. +1
    -1
      docker-compose.yml
  2. +4
    -4
      mysql/sql/init.sql
  3. +1
    -1
      src/app/main.py
  4. +2
    -1
      src/app/templates/index.html

+ 1
- 1
docker-compose.yml ファイルの表示

@@ -9,7 +9,6 @@ services:
backend:
ipv4_address: 10.5.0.5


app:
build:
context: ./src
@@ -25,6 +24,7 @@ services:
ipv4_address: 10.5.0.6

networks:
backend:
driver: bridge
ipam:


+ 4
- 4
mysql/sql/init.sql ファイルの表示

@@ -1,12 +1,12 @@

CREATE TABLE `db`.`users` (
'id' INT AUTO_INCREMENT PRIMARY KEY,
`userid` INT AUTO_INCREMENT,
`username` VARCHAR(45) NULL,
`password` VARCHAR(45) NULL,
);
PRIMARY KEY (`userid`));

insert into users values ("admin", "password");
insert into users values ("bernt", "inge");
insert into users values (NULL, "admin", "password");
insert into users values (NULL, "bernt", "inge");

CREATE USER 'root'@'10.5.0.6' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON db.* TO 'root'@'10.5.0.6';

+ 1
- 1
src/app/main.py ファイルの表示

@@ -91,7 +91,7 @@ class register:
# Register new user in database
def POST(self):
cursor = db.cursor()
query = ("INSERT INTO users VALUES ((%s), (%s))")
query = ("INSERT INTO users VALUES (NULL, (%s), (%s))")
data = web.input()
cursor.execute(query, (data.username, data.password))
cursor.close()


+ 2
- 1
src/app/templates/index.html ファイルの表示

@@ -14,7 +14,8 @@ $def with (login_form, friends)
<img src="static/friends.jpeg" alt="Friends">
<br>
<a href="register">Become A Friend</a>
<br>
<a href="register">Become A Friend!</a>

<h3>Log In</h3>
<form method="POST">


読み込み中…
キャンセル
保存