Fixed W12
This commit is contained in:
parent
ee0715c3b2
commit
8680f03b91
19 changed files with 444 additions and 253 deletions
|
|
@ -1,19 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "nuark/w12",
|
"name": "jenya/laba",
|
||||||
"description": "Work 12 app",
|
"description": "Laba",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Nuark\\W12\\": "src/"
|
"Jenya\\Laba\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Andrew",
|
|
||||||
"email": "me@nuark.xyz"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
"require": {
|
||||||
"pecee/simple-router": "4.3.7.2",
|
"pecee/simple-router": "4.3.7.2",
|
||||||
"twig/twig": "^3.3"
|
"twig/twig": "^3.3"
|
||||||
|
|
|
||||||
102
w12/db-init.sql
Normal file
102
w12/db-init.sql
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
-- COMMENT ON SCHEMA public IS 'standard public schema';
|
||||||
|
--SET default_tablespace = '';
|
||||||
|
--SET default_table_access_method = heap;
|
||||||
|
CREATE TABLE public.images (
|
||||||
|
id integer NOT NULL,
|
||||||
|
filename character varying(255) NOT NULL,
|
||||||
|
user_id integer NOT NULL,
|
||||||
|
published boolean DEFAULT false,
|
||||||
|
description character varying(255) DEFAULT ''::character varying NOT NULL,
|
||||||
|
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.images_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.images_id_seq OWNED BY public.images.id;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.images_user_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.images_user_id_seq OWNED BY public.images.user_id;
|
||||||
|
|
||||||
|
CREATE TABLE public.menu (
|
||||||
|
id integer NOT NULL,
|
||||||
|
user_id integer NOT NULL,
|
||||||
|
data character varying DEFAULT '[]'::character varying
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.menu_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.menu_id_seq OWNED BY public.menu.id;
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.menu_user_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.menu_user_id_seq OWNED BY public.menu.user_id;
|
||||||
|
|
||||||
|
CREATE TABLE public.users (
|
||||||
|
id integer NOT NULL,
|
||||||
|
login character varying(255) NOT NULL,
|
||||||
|
password character varying(255) NOT NULL,
|
||||||
|
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.users_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.images ALTER COLUMN id SET DEFAULT nextval('public.images_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.images ALTER COLUMN user_id SET DEFAULT nextval('public.images_user_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.menu ALTER COLUMN id SET DEFAULT nextval('public.menu_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.menu ALTER COLUMN user_id SET DEFAULT nextval('public.menu_user_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.images
|
||||||
|
ADD CONSTRAINT images_pk PRIMARY KEY (id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.menu
|
||||||
|
ADD CONSTRAINT menu_pk PRIMARY KEY (id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.users
|
||||||
|
ADD CONSTRAINT users_pk PRIMARY KEY (id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.users
|
||||||
|
ADD CONSTRAINT users_un UNIQUE (login);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.images
|
||||||
|
ADD CONSTRAINT images_fk FOREIGN KEY (user_id) REFERENCES public.users(id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.menu
|
||||||
|
ADD CONSTRAINT menu_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||||
|
|
@ -53,7 +53,7 @@ SimpleRouter::post('/register', function() {
|
||||||
|
|
||||||
// if login or password is empty, redirect to register page with error
|
// if login or password is empty, redirect to register page with error
|
||||||
if (empty($login) || empty($password)) {
|
if (empty($login) || empty($password)) {
|
||||||
return response()->redirect('/register?error=Empty login or password given!');
|
return response()->redirect('/register?error=Проверьте данные формы!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// try create user if ok - redirect to login page with message
|
// try create user if ok - redirect to login page with message
|
||||||
|
|
@ -61,9 +61,9 @@ SimpleRouter::post('/register', function() {
|
||||||
Database::createUser($login, $password);
|
Database::createUser($login, $password);
|
||||||
$user = Database::getUser($login);
|
$user = Database::getUser($login);
|
||||||
Database::createEmptyMenuForUser($user);
|
Database::createEmptyMenuForUser($user);
|
||||||
response()->redirect('/login?message=User created');
|
response()->redirect('/login?message=Пользователь создан');
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
response()->redirect('/register?error=User already exists!');
|
response()->redirect('/register?error=Пользователь уже существует!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -89,13 +89,13 @@ SimpleRouter::post('/login', function() {
|
||||||
|
|
||||||
// if login or password is empty, redirect to register page with error
|
// if login or password is empty, redirect to register page with error
|
||||||
if (empty($login) || empty($password)) {
|
if (empty($login) || empty($password)) {
|
||||||
return response()->redirect('/login?error=Empty login or password given!');
|
return response()->redirect('/login?error=Проверьте данные формы!');
|
||||||
}
|
}
|
||||||
if (!Database::userExists($login)) {
|
if (!Database::userExists($login)) {
|
||||||
return response()->redirect('/login?error=User does not exist!');
|
return response()->redirect('/login?error=Пользователь не существует!');
|
||||||
}
|
}
|
||||||
if (!Database::verifyUser($login, $password)) {
|
if (!Database::verifyUser($login, $password)) {
|
||||||
return response()->redirect('/login?error=Wrong password!');
|
return response()->redirect('/login?error=Неправильный пароль!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Database::getUser($login);
|
$user = Database::getUser($login);
|
||||||
|
|
@ -223,8 +223,9 @@ SimpleRouter::post('/uploadImage', function() {
|
||||||
$source = imagecreatefromjpeg($fullpath);
|
$source = imagecreatefromjpeg($fullpath);
|
||||||
|
|
||||||
imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
|
imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
|
||||||
$color = imagecolorallocate($thumb, 255, 0, 0);
|
$color = imagecolorallocate($thumb, 0, 255, 0);
|
||||||
imagestring($thumb, 2, 2, 2, "Watermark text :)", $color);
|
$ulogin = getSessionVariable('user')['login'];
|
||||||
|
imagestring($thumb, 2, 2, 2, "$ulogin @ LABA", $color);
|
||||||
imagejpeg($thumb, 'data/thumb/' . $filename);
|
imagejpeg($thumb, 'data/thumb/' . $filename);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -290,7 +291,6 @@ SimpleRouter::post('/image/{id}', function($id) {
|
||||||
|
|
||||||
$description = input()->post('description', '')->value;
|
$description = input()->post('description', '')->value;
|
||||||
$published = boolval(input()->post('published', 0)->value)?"true":"false";
|
$published = boolval(input()->post('published', 0)->value)?"true":"false";
|
||||||
var_dump($published);
|
|
||||||
try {
|
try {
|
||||||
Database::updateImage($id, $description, $published);
|
Database::updateImage($id, $description, $published);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
|
|
@ -366,12 +366,12 @@ SimpleRouter::post('/import', function() {
|
||||||
if ($xml) {
|
if ($xml) {
|
||||||
try {
|
try {
|
||||||
list($ok, $fail) = Database::importUsersXML($xml);
|
list($ok, $fail) = Database::importUsersXML($xml);
|
||||||
response()->redirect("/import?message=OK: $ok, FAIL: $fail");
|
response()->redirect("/import?message=OK: $ok, КРАХ: $fail");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
response()->redirect("/import?error=" . $e->getMessage());
|
response()->redirect("/import?error=" . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response()->redirect('/import?error=Error happened ');
|
response()->redirect('/import?error=Произошла ошибка');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -421,15 +421,15 @@ SimpleRouter::post('/recover-password', function() use ($twig) {
|
||||||
'login' => $login,
|
'login' => $login,
|
||||||
'password' => $newPassword,
|
'password' => $newPassword,
|
||||||
]);
|
]);
|
||||||
response()->redirect('/recover-password?message=Success! We sent you an email with your new password&mail=' . urlencode($sentMail));
|
response()->redirect('/recover-password?message=Сообщение с паролем отправлено&mail=' . urlencode($sentMail));
|
||||||
} else {
|
} else {
|
||||||
response()->redirect('/recover-password?error=User not found');
|
response()->redirect('/recover-password?error=Пользователь не найден!');
|
||||||
}
|
}
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
response()->redirect('/recover-password?error=' . $e->getMessage());
|
response()->redirect('/recover-password?error=' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response()->redirect('/recover-password?error=Error happened');
|
response()->redirect('/recover-password?error=Произошла ошибка');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
BIN
w12/laba12.zip
Normal file
BIN
w12/laba12.zip
Normal file
Binary file not shown.
1
w12/log.txt
Normal file
1
w12/log.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
'admin'
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
// simple database PDO utilizing the Postgres driver
|
// simple database PDO utilizing the Postgres driver
|
||||||
class Database {
|
class Database {
|
||||||
private static $db;
|
private static $db;
|
||||||
private static $dsn = 'pgsql:host=localhost;port=5432;dbname=w12';
|
private static $dsn = 'pgsql:host=localhost;port=9001;dbname=db';
|
||||||
private static $username = 'postgres';
|
private static $username = 'db';
|
||||||
private static $password = 'asarch6122';
|
private static $password = 'postgres';
|
||||||
private static $options = [
|
private static $options = [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
|
|
@ -56,11 +56,11 @@ class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateUserNewPassword($login) {
|
public static function generateUserNewPassword($login) {
|
||||||
|
$password = bin2hex(random_bytes(8));
|
||||||
$db = self::getDB();
|
$db = self::getDB();
|
||||||
$query = $db->prepare('UPDATE users SET password = :password WHERE login = :login');
|
$query = $db->prepare('UPDATE users SET password = :password WHERE login = :login');
|
||||||
$query->bindParam(':login', $login);
|
$query->bindParam(':login', $login);
|
||||||
$query->bindParam(':password', $password);
|
$query->bindParam(':password', $password);
|
||||||
$password = bin2hex(random_bytes(8));
|
|
||||||
$query->execute();
|
$query->execute();
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Редактирование меню{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style type="text/css">
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<b>{{user.login}}</b>, вы редактируете меню. <a href="/">На главную</a>
|
<b>{{user.login}}</b>, вы редактируете меню. <a href="/">На главную</a>
|
||||||
<hr>
|
<hr>
|
||||||
<b>Меню:</b>
|
<b>Меню:</b>
|
||||||
|
|
@ -29,7 +31,7 @@
|
||||||
<button id="addItemBtn">+</button>
|
<button id="addItemBtn">+</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="saveBtn">Сохранить</button>
|
<button id="saveBtn">Сохранить</button>
|
||||||
</body>
|
|
||||||
<script>
|
<script>
|
||||||
let menu = [];
|
let menu = [];
|
||||||
|
|
||||||
|
|
@ -69,7 +71,7 @@
|
||||||
document.querySelector('input.inputData[name="url"]').value = '';
|
document.querySelector('input.inputData[name="url"]').value = '';
|
||||||
document.querySelector('input.inputData[name="name"]').value = '';
|
document.querySelector('input.inputData[name="name"]').value = '';
|
||||||
|
|
||||||
updateDeleteBtns()
|
updateDeleteBtns();
|
||||||
});
|
});
|
||||||
|
|
||||||
saveBtn.addEventListener('click', async function() {
|
saveBtn.addEventListener('click', async function() {
|
||||||
|
|
@ -92,8 +94,10 @@
|
||||||
}
|
}
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateDeleteBtns();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', init);
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
</script>
|
</script>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Галерея{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style type="text/css">
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<b>{{user.login}}</b>, вы смотрите свою галерею. <a href="/">На главную</a>
|
<b>{{user.login}}</b>, вы смотрите свою галерею. <a href="/">На главную</a>
|
||||||
<hr>
|
<hr>
|
||||||
{% for image in images %}
|
{% for image in images %}
|
||||||
|
|
@ -16,5 +18,4 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Нет изображений</p>
|
<p>Нет изображений</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Просмотр изображения{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style type="text/css">
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<b>{{user.login}}</b> осматривает картинку... <a href="/">На главную</a>
|
<b>{{user.login}}</b> осматривает картинку... <a href="/">На главную</a>
|
||||||
<hr>
|
<hr>
|
||||||
<img src="/images?type=full&filename={{image.filename}}" alt="{{image.filename}}" style="max-width: 100%">
|
<img src="/images?type=full&filename={{image.filename}}" alt="{{image.filename}}" style="max-width: 100%">
|
||||||
|
|
@ -22,5 +24,4 @@
|
||||||
<input type="submit" value="Сохранить">
|
<input type="submit" value="Сохранить">
|
||||||
</form>
|
</form>
|
||||||
<a href="/image/{{image.id}}/delete">Удалить</a>
|
<a href="/image/{{image.id}}/delete">Удалить</a>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
@ -1,26 +1,27 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Импорт пользователей{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
{% if message %}
|
{% if message %}
|
||||||
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4>Import page</h4>
|
<h4>Импорт</h4>
|
||||||
<p>Drop XML file on page or enter content down here</p>
|
<p>Перенесите XML файл дампа на форму или вставьте содерживое в поле</p>
|
||||||
<form action="/import" method="post">
|
<form action="/import" method="post">
|
||||||
<textarea name="xml" cols="30" rows="10"></textarea>
|
<textarea name="xml" cols="30" rows="10"></textarea>
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" name="submit" value="submit">
|
<input type="submit" name="submit" value="submit">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
let dropZone = document.body;
|
let dropZone = document.body;
|
||||||
|
|
@ -48,4 +49,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
}, false);
|
}, false);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Document</title>
|
|
||||||
|
|
||||||
|
{% block title %}Главная страница{% endblock %}
|
||||||
|
{% block head %}
|
||||||
|
{{ parent() }}
|
||||||
<style>
|
<style>
|
||||||
#imageDrop {
|
#imageDrop {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -18,8 +15,9 @@
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
{% endblock %}
|
||||||
<body>
|
|
||||||
|
{% block content %}
|
||||||
Привет, {{user.login}}! <a href="/logout">Выйти</a>
|
Привет, {{user.login}}! <a href="/logout">Выйти</a>
|
||||||
<hr>
|
<hr>
|
||||||
<b>Меню:</b>
|
<b>Меню:</b>
|
||||||
|
|
@ -105,4 +103,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,27 +1,52 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Вход{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
body {
|
||||||
</head>
|
display: flex;
|
||||||
<body>
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background: rgb(15 33 33);
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-holder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
background: rgb(185 255 245);
|
||||||
|
width: fit-content;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-holder">
|
||||||
{% if message %}
|
{% if message %}
|
||||||
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4>Login page</h4>
|
<h4>Вход</h4>
|
||||||
<form action="/login" method="post">
|
<form action="/login" method="post">
|
||||||
<input type="text" name="login" placeholder="login">
|
<input type="text" name="login" placeholder="Логин">
|
||||||
<input type="password" name="password" placeholder="password">
|
<input type="password" name="password" placeholder="Пароль">
|
||||||
<input type="submit" name="submit" value="submit">
|
<input type="submit" name="submit" value="Войти">
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
<a href="/register">Registration</a>
|
<a href="/register">Зарегистрироваться</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="/recover-password">Recover password</a>
|
<a href="/recover-password">Восстановить пароль</a>
|
||||||
</body>
|
</div>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Просмотр таблиц{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
{% if table %}
|
{% if table %}
|
||||||
<b>{{user.login}}</b>, вы смотрите таблицу <i>{{table}}</i>. <a href="/lookupTables">Отмена</a>
|
<b>{{user.login}}</b>, вы смотрите таблицу <i>{{table}}</i>. <a href="/lookupTables">Отмена</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
@ -46,5 +48,4 @@
|
||||||
<input type="submit" value="Перейти">
|
<input type="submit" value="Перейти">
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Гейтвей{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
</style>
|
||||||
<body>
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
Вам нужно <a href="/login">войти</a> или <a href="/register">зарегистрироваться</a> для работы с системой.
|
Вам нужно <a href="/login">войти</a> или <a href="/register">зарегистрироваться</a> для работы с системой.
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
Hello, {{login}}!
|
Привет, {{login}}!
|
||||||
You have requested password change, so we generated you a new one (without backtics): `<b>{{password}}</b>`.
|
Похоже, ты ззабыл свой пароль, вот тебе новый (без кавычек): `<b>{{password}}</b>`.
|
||||||
<br>
|
<hr>
|
||||||
Please be sure to delete this message after you have logged in. For now you cannot change your password by yourself.
|
Удали это сообщение после входа, чтобы его никто не прочитал!
|
||||||
|
|
@ -1,12 +1,37 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Восстановление парля{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
body {
|
||||||
</head>
|
display: flex;
|
||||||
<body>
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background: rgb(15 33 33);
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-holder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
background: rgb(185 255 245);
|
||||||
|
width: fit-content;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-holder">
|
||||||
{% if mail %}
|
{% if mail %}
|
||||||
<div id="mail" style="padding: 1rem; border: 2px solid black; background-color: lightsteelblue; color: stellblue">{{mail | raw}}</div>
|
<div id="mail" style="padding: 1rem; border: 2px solid black; background-color: lightsteelblue; color: stellblue">{{mail | raw}}</div>
|
||||||
<br>
|
<br>
|
||||||
|
|
@ -19,14 +44,14 @@
|
||||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||||
<br>
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4>Password recovery page</h4>
|
<h4>Восстановление пароля</h4>
|
||||||
<form action="/recover-password" method="post">
|
<form action="/recover-password" method="post">
|
||||||
<input type="text" name="login" placeholder="login">
|
<input type="text" name="login" placeholder="Логин">
|
||||||
<input type="submit" name="submit" value="submit">
|
<input type="submit" name="submit" value="Восстановить">
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
<a href="/register">Registration</a>
|
<a href="/register">Зарегистрироваться</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="/login">Login</a>
|
<a href="/login">Войти</a>
|
||||||
</body>
|
</div>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,24 +1,49 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
{% block title %}Регистрация{% endblock %}
|
||||||
<meta charset="UTF-8">
|
{% block head %}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
{{ parent() }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<style>
|
||||||
<title>Document</title>
|
body {
|
||||||
</head>
|
display: flex;
|
||||||
<body>
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background: rgb(15 33 33);
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-holder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
background: rgb(185 255 245);
|
||||||
|
width: fit-content;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-holder">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4>Registration page</h4>
|
<h4>Регистрация</h4>
|
||||||
<form action="/register" method="post">
|
<form action="/register" method="post">
|
||||||
<input type="text" name="login" placeholder="login">
|
<input type="text" name="login" placeholder="Логин">
|
||||||
<input type="password" name="password" placeholder="password">
|
<input type="password" name="password" placeholder="Пароль">
|
||||||
<input type="submit" name="submit" value="submit">
|
<input type="submit" name="submit" value="Войти">
|
||||||
</form>
|
</form>
|
||||||
<hr>
|
<hr>
|
||||||
<a href="/login">Login</a>
|
<a href="/login">Войти</a>
|
||||||
<br>
|
<br>
|
||||||
<a href="/recover-password">Recover password</a>
|
<a href="/recover-password">Восстановить пароль</a>
|
||||||
</body>
|
</div>
|
||||||
</html>
|
{% endblock %}
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
<!DOCTYPE html>
|
{% extends "template.twig" %}
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Document</title>
|
|
||||||
|
|
||||||
|
{% block title %}Импорт пользователей{% endblock %}
|
||||||
|
{% block head %}
|
||||||
|
{{ parent() }}
|
||||||
<style>
|
<style>
|
||||||
#imageDrop {
|
#imageDrop {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -18,8 +15,9 @@
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
{% endblock %}
|
||||||
<body>
|
|
||||||
|
{% block content %}
|
||||||
<b>{{user.login}}</b> что-то ищет 🤔 <a href="/">На главную</a>
|
<b>{{user.login}}</b> что-то ищет 🤔 <a href="/">На главную</a>
|
||||||
<hr>
|
<hr>
|
||||||
<form action="/search" method="get">
|
<form action="/search" method="get">
|
||||||
|
|
@ -46,5 +44,4 @@
|
||||||
<p>Пусто</p>
|
<p>Пусто</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
15
w12/views/template.twig
Normal file
15
w12/views/template.twig
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
{% block head %}
|
||||||
|
<!--link rel="stylesheet" href="style.css"/-->
|
||||||
|
<title>{% block title %}{% endblock %}</title>
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="content">{% block content %}{% endblock %}</div>
|
||||||
|
<div id="footer">{% block footer %}{% endblock %}</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue