Added Login
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
spring.application.name=Misael
|
||||
spring.session.jdbc.initialize-schema=always
|
||||
@@ -0,0 +1,27 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:10051/misael
|
||||
username: misael
|
||||
password: misael-dev
|
||||
hikari:
|
||||
schema: misael
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration/structure, classpath:db/migration/data
|
||||
validate-on-migrate: true
|
||||
default-schema: misael
|
||||
|
||||
# jpa:
|
||||
# properties:
|
||||
# javax:
|
||||
# persistence:
|
||||
# schema-generation:
|
||||
# create-source: metadata
|
||||
# scripts:
|
||||
# action: update
|
||||
# create-target: db-migration.sql
|
||||
# database:
|
||||
# action: none
|
||||
# hibernate:
|
||||
# ddl-auto: none
|
||||
# generate-ddl: true
|
||||
@@ -0,0 +1,7 @@
|
||||
create table roles (id bigint generated by default as identity, name varchar(255) not null, primary key (id));
|
||||
create table users (id bigint generated by default as identity, name varchar(255) not null, password varchar(255) not null, primary key (id));
|
||||
create table users_roles (user_id bigint not null, role_id bigint not null);
|
||||
alter table if exists roles drop constraint if exists UKofx66keruapi6vyqpv6f2or37;
|
||||
alter table if exists roles add constraint UKofx66keruapi6vyqpv6f2or37 unique (name);
|
||||
alter table if exists users_roles add constraint FKj6m8fwv7oqv74fcehir1a9ffy foreign key (role_id) references roles;
|
||||
alter table if exists users_roles add constraint FK2o0jvgh89lemvvo17cbqvdxaa foreign key (user_id) references users;
|
||||
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
<div th:replace="~{html-head}"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{header}"/>
|
||||
<main>
|
||||
|
||||
<div th:if="${param.success}">
|
||||
You have successfully registered our app!
|
||||
</div>
|
||||
<form
|
||||
method="post"
|
||||
role="form"
|
||||
th:action="@{/adduser/save}"
|
||||
th:object="${user}"
|
||||
>
|
||||
<label for="name">Name</label>
|
||||
<input
|
||||
id="name"
|
||||
name="name"
|
||||
placeholder="Enter pseudo"
|
||||
th:field="*{name}"
|
||||
type="text"
|
||||
/>
|
||||
<p th:errors = "*{name}" th:if="${#fields.hasErrors('name')}"></p>
|
||||
|
||||
<label for="password">Password</label>
|
||||
<input
|
||||
id="password"
|
||||
name="password"
|
||||
placeholder="Enter password"
|
||||
th:field="*{password}"
|
||||
type="password"
|
||||
/>
|
||||
<p th:errors = "*{password}" class="text-danger"
|
||||
th:if="${#fields.hasErrors('password')}"></p>
|
||||
|
||||
<button class="btn btn-primary" type="submit">Register</button>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul class="menu">
|
||||
<li><a href="/questions/quizz">Quizz</a></li>
|
||||
<li><a href="/questions/forms">Forms</a></li>
|
||||
<li><a href="/questions/login">Login</a></li>
|
||||
<li><a href="/login">Login</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
<div th:replace="~{html-head}"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div th:replace="~{header}"/>
|
||||
<main>
|
||||
Logged in as <div th:text="${username}"></div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,14 +8,24 @@
|
||||
<div th:replace="~{header}"/>
|
||||
<main>
|
||||
|
||||
<form>
|
||||
<label for="login-pseudo">Pseudo :</label>
|
||||
<input type="text" id="login-pseudo" name="pseudo"/>
|
||||
<div th:if="${param.error}">
|
||||
<div class="alert alert-danger">Invalid Email or Password</div><br/>
|
||||
</div>
|
||||
<div th:if="${param.logout}">
|
||||
<div class="alert alert-success"> You have been logged out.</div><br/>
|
||||
</div>
|
||||
|
||||
<form
|
||||
method="post"
|
||||
role="form"
|
||||
th:action="@{/login}">
|
||||
<label for="username">Pseudo :</label>
|
||||
<input type="text" id="username" name="username"/>
|
||||
<br/>
|
||||
<label for="login-password">Mot de passe :</label>
|
||||
<input type="text" id="login-password" name="password"/>
|
||||
<label for="password">Mot de passe :</label>
|
||||
<input type="password" id="password" name="password"/>
|
||||
<br/>
|
||||
<input id="connect" type="button">Se connecter</input>
|
||||
<input id="connect" type="submit">Se connecter</input>
|
||||
</form>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user