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",
|
||||
"description": "Work 12 app",
|
||||
"name": "jenya/laba",
|
||||
"description": "Laba",
|
||||
"type": "project",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Nuark\\W12\\": "src/"
|
||||
"Jenya\\Laba\\": "src/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Andrew",
|
||||
"email": "me@nuark.xyz"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"pecee/simple-router": "4.3.7.2",
|
||||
"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 (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
|
||||
|
|
@ -61,9 +61,9 @@ SimpleRouter::post('/register', function() {
|
|||
Database::createUser($login, $password);
|
||||
$user = Database::getUser($login);
|
||||
Database::createEmptyMenuForUser($user);
|
||||
response()->redirect('/login?message=User created');
|
||||
response()->redirect('/login?message=Пользователь создан');
|
||||
} 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 (empty($login) || empty($password)) {
|
||||
return response()->redirect('/login?error=Empty login or password given!');
|
||||
return response()->redirect('/login?error=Проверьте данные формы!');
|
||||
}
|
||||
if (!Database::userExists($login)) {
|
||||
return response()->redirect('/login?error=User does not exist!');
|
||||
return response()->redirect('/login?error=Пользователь не существует!');
|
||||
}
|
||||
if (!Database::verifyUser($login, $password)) {
|
||||
return response()->redirect('/login?error=Wrong password!');
|
||||
return response()->redirect('/login?error=Неправильный пароль!');
|
||||
}
|
||||
|
||||
$user = Database::getUser($login);
|
||||
|
|
@ -223,8 +223,9 @@ SimpleRouter::post('/uploadImage', function() {
|
|||
$source = imagecreatefromjpeg($fullpath);
|
||||
|
||||
imagecopyresized($thumb, $source, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
|
||||
$color = imagecolorallocate($thumb, 255, 0, 0);
|
||||
imagestring($thumb, 2, 2, 2, "Watermark text :)", $color);
|
||||
$color = imagecolorallocate($thumb, 0, 255, 0);
|
||||
$ulogin = getSessionVariable('user')['login'];
|
||||
imagestring($thumb, 2, 2, 2, "$ulogin @ LABA", $color);
|
||||
imagejpeg($thumb, 'data/thumb/' . $filename);
|
||||
|
||||
try {
|
||||
|
|
@ -290,7 +291,6 @@ SimpleRouter::post('/image/{id}', function($id) {
|
|||
|
||||
$description = input()->post('description', '')->value;
|
||||
$published = boolval(input()->post('published', 0)->value)?"true":"false";
|
||||
var_dump($published);
|
||||
try {
|
||||
Database::updateImage($id, $description, $published);
|
||||
} catch (PDOException $e) {
|
||||
|
|
@ -366,12 +366,12 @@ SimpleRouter::post('/import', function() {
|
|||
if ($xml) {
|
||||
try {
|
||||
list($ok, $fail) = Database::importUsersXML($xml);
|
||||
response()->redirect("/import?message=OK: $ok, FAIL: $fail");
|
||||
response()->redirect("/import?message=OK: $ok, КРАХ: $fail");
|
||||
} catch (Exception $e) {
|
||||
response()->redirect("/import?error=" . $e->getMessage());
|
||||
}
|
||||
} else {
|
||||
response()->redirect('/import?error=Error happened ');
|
||||
response()->redirect('/import?error=Произошла ошибка');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -421,15 +421,15 @@ SimpleRouter::post('/recover-password', function() use ($twig) {
|
|||
'login' => $login,
|
||||
'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 {
|
||||
response()->redirect('/recover-password?error=User not found');
|
||||
response()->redirect('/recover-password?error=Пользователь не найден!');
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
response()->redirect('/recover-password?error=' . $e->getMessage());
|
||||
}
|
||||
} 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
|
||||
class Database {
|
||||
private static $db;
|
||||
private static $dsn = 'pgsql:host=localhost;port=5432;dbname=w12';
|
||||
private static $username = 'postgres';
|
||||
private static $password = 'asarch6122';
|
||||
private static $dsn = 'pgsql:host=localhost;port=9001;dbname=db';
|
||||
private static $username = 'db';
|
||||
private static $password = 'postgres';
|
||||
private static $options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
|
|
@ -56,11 +56,11 @@ class Database {
|
|||
}
|
||||
|
||||
public static function generateUserNewPassword($login) {
|
||||
$password = bin2hex(random_bytes(8));
|
||||
$db = self::getDB();
|
||||
$query = $db->prepare('UPDATE users SET password = :password WHERE login = :login');
|
||||
$query->bindParam(':login', $login);
|
||||
$query->bindParam(':password', $password);
|
||||
$password = bin2hex(random_bytes(8));
|
||||
$query->execute();
|
||||
return $password;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Редактирование меню{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<b>{{user.login}}</b>, вы редактируете меню. <a href="/">На главную</a>
|
||||
<hr>
|
||||
<b>Меню:</b>
|
||||
|
|
@ -29,7 +31,7 @@
|
|||
<button id="addItemBtn">+</button>
|
||||
</div>
|
||||
<button id="saveBtn">Сохранить</button>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
let menu = [];
|
||||
|
||||
|
|
@ -69,7 +71,7 @@
|
|||
document.querySelector('input.inputData[name="url"]').value = '';
|
||||
document.querySelector('input.inputData[name="name"]').value = '';
|
||||
|
||||
updateDeleteBtns()
|
||||
updateDeleteBtns();
|
||||
});
|
||||
|
||||
saveBtn.addEventListener('click', async function() {
|
||||
|
|
@ -92,8 +94,10 @@
|
|||
}
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
updateDeleteBtns();
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
</script>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Галерея{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<b>{{user.login}}</b>, вы смотрите свою галерею. <a href="/">На главную</a>
|
||||
<hr>
|
||||
{% for image in images %}
|
||||
|
|
@ -16,5 +18,4 @@
|
|||
{% else %}
|
||||
<p>Нет изображений</p>
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Просмотр изображения{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<b>{{user.login}}</b> осматривает картинку... <a href="/">На главную</a>
|
||||
<hr>
|
||||
<img src="/images?type=full&filename={{image.filename}}" alt="{{image.filename}}" style="max-width: 100%">
|
||||
|
|
@ -22,5 +24,4 @@
|
|||
<input type="submit" value="Сохранить">
|
||||
</form>
|
||||
<a href="/image/{{image.id}}/delete">Удалить</a>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,26 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Импорт пользователей{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if message %}
|
||||
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
||||
{% endif %}
|
||||
{% if error %}
|
||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||
{% endif %}
|
||||
<h4>Import page</h4>
|
||||
<p>Drop XML file on page or enter content down here</p>
|
||||
<h4>Импорт</h4>
|
||||
<p>Перенесите XML файл дампа на форму или вставьте содерживое в поле</p>
|
||||
<form action="/import" method="post">
|
||||
<textarea name="xml" cols="30" rows="10"></textarea>
|
||||
<br>
|
||||
<input type="submit" name="submit" value="submit">
|
||||
</form>
|
||||
</body>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let dropZone = document.body;
|
||||
|
|
@ -48,4 +49,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
}, false);
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Главная страница{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
#imageDrop {
|
||||
display: flex;
|
||||
|
|
@ -18,8 +15,9 @@
|
|||
border-radius: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Привет, {{user.login}}! <a href="/logout">Выйти</a>
|
||||
<hr>
|
||||
<b>Меню:</b>
|
||||
|
|
@ -105,4 +103,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
});
|
||||
|
||||
</script>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,27 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Вход{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
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 %}
|
||||
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
|
||||
{% endif %}
|
||||
{% if error %}
|
||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||
{% endif %}
|
||||
<h4>Login page</h4>
|
||||
<h4>Вход</h4>
|
||||
<form action="/login" method="post">
|
||||
<input type="text" name="login" placeholder="login">
|
||||
<input type="password" name="password" placeholder="password">
|
||||
<input type="submit" name="submit" value="submit">
|
||||
<input type="text" name="login" placeholder="Логин">
|
||||
<input type="password" name="password" placeholder="Пароль">
|
||||
<input type="submit" name="submit" value="Войти">
|
||||
</form>
|
||||
<hr>
|
||||
<a href="/register">Registration</a>
|
||||
<a href="/register">Зарегистрироваться</a>
|
||||
<br>
|
||||
<a href="/recover-password">Recover password</a>
|
||||
</body>
|
||||
</html>
|
||||
<a href="/recover-password">Восстановить пароль</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Просмотр таблиц{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if table %}
|
||||
<b>{{user.login}}</b>, вы смотрите таблицу <i>{{table}}</i>. <a href="/lookupTables">Отмена</a>
|
||||
{% else %}
|
||||
|
|
@ -46,5 +48,4 @@
|
|||
<input type="submit" value="Перейти">
|
||||
</form>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Гейтвей{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Вам нужно <a href="/login">войти</a> или <a href="/register">зарегистрироваться</a> для работы с системой.
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Hello, {{login}}!
|
||||
You have requested password change, so we generated you a new one (without backtics): `<b>{{password}}</b>`.
|
||||
<br>
|
||||
Please be sure to delete this message after you have logged in. For now you cannot change your password by yourself.
|
||||
Привет, {{login}}!
|
||||
Похоже, ты ззабыл свой пароль, вот тебе новый (без кавычек): `<b>{{password}}</b>`.
|
||||
<hr>
|
||||
Удали это сообщение после входа, чтобы его никто не прочитал!
|
||||
|
|
@ -1,12 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Восстановление парля{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
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 %}
|
||||
<div id="mail" style="padding: 1rem; border: 2px solid black; background-color: lightsteelblue; color: stellblue">{{mail | raw}}</div>
|
||||
<br>
|
||||
|
|
@ -19,14 +44,14 @@
|
|||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
<h4>Password recovery page</h4>
|
||||
<h4>Восстановление пароля</h4>
|
||||
<form action="/recover-password" method="post">
|
||||
<input type="text" name="login" placeholder="login">
|
||||
<input type="submit" name="submit" value="submit">
|
||||
<input type="text" name="login" placeholder="Логин">
|
||||
<input type="submit" name="submit" value="Восстановить">
|
||||
</form>
|
||||
<hr>
|
||||
<a href="/register">Registration</a>
|
||||
<a href="/register">Зарегистрироваться</a>
|
||||
<br>
|
||||
<a href="/login">Login</a>
|
||||
</body>
|
||||
</html>
|
||||
<a href="/login">Войти</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,24 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Регистрация{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
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 %}
|
||||
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
|
||||
{% endif %}
|
||||
<h4>Registration page</h4>
|
||||
<h4>Регистрация</h4>
|
||||
<form action="/register" method="post">
|
||||
<input type="text" name="login" placeholder="login">
|
||||
<input type="password" name="password" placeholder="password">
|
||||
<input type="submit" name="submit" value="submit">
|
||||
<input type="text" name="login" placeholder="Логин">
|
||||
<input type="password" name="password" placeholder="Пароль">
|
||||
<input type="submit" name="submit" value="Войти">
|
||||
</form>
|
||||
<hr>
|
||||
<a href="/login">Login</a>
|
||||
<a href="/login">Войти</a>
|
||||
<br>
|
||||
<a href="/recover-password">Recover password</a>
|
||||
</body>
|
||||
</html>
|
||||
<a href="/recover-password">Восстановить пароль</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<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>
|
||||
{% extends "template.twig" %}
|
||||
|
||||
{% block title %}Импорт пользователей{% endblock %}
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
<style>
|
||||
#imageDrop {
|
||||
display: flex;
|
||||
|
|
@ -18,8 +15,9 @@
|
|||
border-radius: 1rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<b>{{user.login}}</b> что-то ищет 🤔 <a href="/">На главную</a>
|
||||
<hr>
|
||||
<form action="/search" method="get">
|
||||
|
|
@ -46,5 +44,4 @@
|
|||
<p>Пусто</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
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