This commit is contained in:
Anthony Stirling
2023-08-12 02:29:10 +01:00
parent 83ba1899b7
commit 6f325b5fdb
17 changed files with 718 additions and 3 deletions

View File

@@ -16,8 +16,11 @@ server.error.include-stacktrace=always
server.error.include-exception=true
server.error.include-message=always
#logging.level.org.springframework.web=DEBUG
logging.level.org.springframework.web=DEBUG
logging.level.org.springframework=DEBUG
logging.level.org.springframework.security=DEBUG
login.enabled=true
server.servlet.session.tracking-modes=cookie
server.servlet.context-path=${APP_ROOT_PATH:/}
@@ -32,4 +35,12 @@ spring.mvc.async.request-timeout=${ASYNC_CONNECTION_TIMEOUT:300000}
spring.resources.static-locations=file:customFiles/static/
#spring.thymeleaf.prefix=file:/customFiles/templates/,classpath:/templates/
#spring.thymeleaf.cache=false
#spring.thymeleaf.cache=false
spring.datasource.url=jdbc:h2:file:./mydatabase;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=update

View File

@@ -55,6 +55,15 @@ settings.downloadOption.2=Open in new window
settings.downloadOption.3=Download file
settings.zipThreshold=Zip files when the number of downloaded files exceeds
settings.userSettings=User Settings
settings.changeUsername=New Username
settings.changeUsernameButton=Change Username
settings.password=Password
settings.oldPassword=Old password
settings.newPassword=New Password
settings.changePasswordButton=Change Password
settings.confirmNewPassword=Confirm New Password
settings.signOut=Sign Out
#############
# HOME-PAGE #
#############

View File

@@ -338,6 +338,49 @@
<label class="custom-control-label" for="boredWaiting" th:text="#{bored}"></label>
</div>
</div>
<hr>
<h5 th:text="#{settings.userSettings}">User Settings</h5>
<form action="/change-username" method="post">
<div class="form-group">
<label for="newUsername" th:text="#{settings.changeUsername}">Change Username</label>
<input type="text" class="form-control" name="newUsername" id="newUsername" placeholder="New Username">
</div>
<div class="form-group">
<label for="password" th:text="#{settings.password}">Password</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Password">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary" th:text="#{settings.changeUsernameButton}">Change Username</button>
</div>
</form>
<!-- Change Password Form -->
<form action="/change-password" method="post">
<div class="form-group">
<label for="oldPassword" th:text="#{settings.oldPassword}">Old Password</label>
<input type="password" class="form-control" name="oldPassword" id="oldPassword" placeholder="Old Password">
</div>
<div class="form-group">
<label for="newPassword" th:text="#{settings.newPassword}">New Password</label>
<input type="password" class="form-control" name="newPassword" id="newPassword" placeholder="New Password">
</div>
<div class="form-group">
<label for="confirmNewPassword" th:text="#{settings.confirmNewPassword}">Confirm New Password</label>
<input type="password" class="form-control" name="confirmNewPassword" id="confirmNewPassword" placeholder="Confirm New Password">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary" th:text="#{settings.changePasswordButton}">Change Password</button>
</div>
</form>
<!-- Sign Out Button -->
<div class="form-group">
<a href="/logout">
<button type="button" class="btn btn-danger" th:text="#{settings.signOut}">Sign Out</button>
</a>
</div>
</div>
<div class="modal-footer">

View File

@@ -23,6 +23,9 @@
<script src="js/homecard.js"></script>
<div class=" container">
<form th:if="${@loginEnabled == true}" action="#" th:action="@{/logout}" method="post">
<input type="submit" value="Logout" />
</form>
<input type="text" id="searchBar" onkeyup="filterCards()" placeholder="Search for features...">
<div class="features-container ">

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Login</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div id="page-container">
<div id="content-wrap">
<div class="container">
<div class="row justify-content-center align-items-center" style="height:100vh;">
<div class="col-md-4">
<div class="login-container card">
<div class="card-header text-center">
<img src="favicon.svg" alt="Logo" class="img-fluid" style="max-width: 100px;"> <!-- Adjust path and style as needed -->
<h4>Stirling-PDF Login</h4>
</div>
<div th:if="${logoutMessage}" class="alert alert-success" th:text="${logoutMessage}"></div>
<div class="card-body">
<form th:action="@{/login}" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" class="form-control" required="required" />
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" class="form-control" required="required" />
</div>
<div class="form-group text-center">
<input type="submit" value="Login" class="btn btn-primary" />
</div>
</form>
</div>
<div class="card-footer text-danger text-center">
<div th:if="${error == 'badcredentials'}">
Invalid username or password.
</div>
<div th:if="${error == 'locked'}">
Your account has been locked.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div th:insert="~{fragments/footer.html :: footer}"></div>
</div>
</body>
</html>