From d907e43f2dfa47d81b82d5e44c1d7952f8eb71df Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 5 Jul 2020 20:24:15 -0400 Subject: [PATCH 01/21] Create README_projectApp.rd --- README_projectApp.rd | 1 + 1 file changed, 1 insertion(+) create mode 100644 README_projectApp.rd diff --git a/README_projectApp.rd b/README_projectApp.rd new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/README_projectApp.rd @@ -0,0 +1 @@ + From 834452962d504deb6cc9d9d769151836b112de0c Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 5 Jul 2020 20:24:47 -0400 Subject: [PATCH 02/21] Delete README_projectApp.rd --- README_projectApp.rd | 1 - 1 file changed, 1 deletion(-) delete mode 100644 README_projectApp.rd diff --git a/README_projectApp.rd b/README_projectApp.rd deleted file mode 100644 index 8b1378917..000000000 --- a/README_projectApp.rd +++ /dev/null @@ -1 +0,0 @@ - From 465fbaf44df291551039fca9af47aad53cbbd5d7 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 5 Jul 2020 20:25:15 -0400 Subject: [PATCH 03/21] Create README_projectApp.md --- README_projectApp.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README_projectApp.md diff --git a/README_projectApp.md b/README_projectApp.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/README_projectApp.md @@ -0,0 +1 @@ + From 9b8b91a72dc7968e845218f6f0c85ea70f9b80cb Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 5 Jul 2020 20:34:08 -0400 Subject: [PATCH 04/21] Update README_projectApp.md --- README_projectApp.md | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/README_projectApp.md b/README_projectApp.md index 8b1378917..e665d1168 100644 --- a/README_projectApp.md +++ b/README_projectApp.md @@ -1 +1,54 @@ +A YEEFFA FIRED CHAT WEB APPLICATION + + Description + This Case Study I worked on to build a full stack web Application. My web application is a Spring MVC based application, which means you'll learn about what it takes to build a functional application from the ground up yourself. + This is exciting! It's a lot, but we've given you the tools to be able to build what you need, and you get to decide what you do with it. You also get to be creative in choosing what sort of application you want to build! + You will be working individually to design your app. We hope you'll exercise creativity on this project, sketch some wireframes before you start, make sure you have time to run these ideas by your instructors to get their feedback before you dive too deep into coding! Remember to keep things small and focus on mastering the fundamentals. + Additional Resources + The Original Case Study Document + Case Study Outline + Case Study Deliverables + Identifying Plagiarism + Suggested Project Topics + +Minimum Features + + RESTful web service which consumes requests from a front-end web application and caches each request and the respective response to a database. + The application must support a login functionality. + +Developmental Notes +Tech Stack Selection + + Select at least 1 technology from each of the following categories: + + Version Control System + Github + Bitbucket + + Wireframe + Mockflow + Balsamiq + Lucidcharts + + Frontend + Angular + React + Vue.JS + + Business Logic + Java + TypeScript + + Data Layer + MySQL + PostgreSQL + MariaDB + + Web Server Cloud Deployment + Heroku + AWS EC2 Instance + + Web Application Cloud Deployment + Netlify + AWS EC2 Instance From f8a72f01e457842615ccc5edbf86ea04a9573399 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 5 Jul 2020 20:54:17 -0400 Subject: [PATCH 05/21] Update README_projectApp.md --- README_projectApp.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README_projectApp.md b/README_projectApp.md index e665d1168..95d8feef7 100644 --- a/README_projectApp.md +++ b/README_projectApp.md @@ -1,7 +1,7 @@ -A YEEFFA FIRED CHAT WEB APPLICATION +## A YEEFFA FIRED CHAT WEB APPLICATION - Description + **Description This Case Study I worked on to build a full stack web Application. My web application is a Spring MVC based application, which means you'll learn about what it takes to build a functional application from the ground up yourself. This is exciting! It's a lot, but we've given you the tools to be able to build what you need, and you get to decide what you do with it. You also get to be creative in choosing what sort of application you want to build! You will be working individually to design your app. We hope you'll exercise creativity on this project, sketch some wireframes before you start, make sure you have time to run these ideas by your instructors to get their feedback before you dive too deep into coding! Remember to keep things small and focus on mastering the fundamentals. @@ -12,13 +12,13 @@ A YEEFFA FIRED CHAT WEB APPLICATION Identifying Plagiarism Suggested Project Topics -Minimum Features +## Minimum Features RESTful web service which consumes requests from a front-end web application and caches each request and the respective response to a database. The application must support a login functionality. -Developmental Notes -Tech Stack Selection +## Developmental Notes +**Tech Stack Selection** Select at least 1 technology from each of the following categories: From 78ba88999803146d2dc5181d83aa9db864f5fa9c Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 12 Jul 2020 22:42:22 -0400 Subject: [PATCH 06/21] Changes to my first commit for my project --- MyREADME.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ REFERENCE.md | 0 css/color.css | 0 css/login.css | 0 css/style.css | 0 index.html | 0 js/function.js | 0 js/script.js | 0 js/utils.js | 0 login.html | 0 signup.html | 0 11 files changed, 78 insertions(+) create mode 100644 MyREADME.md create mode 100644 REFERENCE.md create mode 100644 css/color.css create mode 100644 css/login.css create mode 100644 css/style.css create mode 100644 index.html create mode 100644 js/function.js create mode 100644 js/script.js create mode 100644 js/utils.js create mode 100644 login.html create mode 100644 signup.html diff --git a/MyREADME.md b/MyREADME.md new file mode 100644 index 000000000..e36767e55 --- /dev/null +++ b/MyREADME.md @@ -0,0 +1,78 @@ +# Product Name +> Short blurb about what your product does. + +[![NPM Version][npm-image]][npm-url] +[![Build Status][travis-image]][travis-url] +[![Downloads Stats][npm-downloads]][npm-url] + +One to two paragraph statement about your product and what it does. + +![](header.png) + +## Installation + +OS X & Linux: + +```sh +npm install my-crazy-module --save +``` + +Windows: + +```sh +edit autoexec.bat +``` + +## Usage example + +A few motivating and useful examples of how your product can be used. Spice this up with code blocks and potentially more screenshots. + +_For more examples and usage, please refer to the [Wiki][wiki]._ + +## Development setup + +Describe how to install all development dependencies and how to run an automated test-suite of some kind. Potentially do this for multiple platforms. + +```sh +make install +npm test +``` + +## Release History + +* 0.2.1 + * CHANGE: Update docs (module code remains unchanged) +* 0.2.0 + * CHANGE: Remove `setDefaultXYZ()` + * ADD: Add `init()` +* 0.1.1 + * FIX: Crash when calling `baz()` (Thanks @GenerousContributorName!) +* 0.1.0 + * The first proper release + * CHANGE: Rename `foo()` to `bar()` +* 0.0.1 + * Work in progress + +## Meta + +Your Name – [@YourTwitter](https://twitter.com/dbader_org) – YourEmail@example.com + +Distributed under the XYZ license. See ``LICENSE`` for more information. + +[https://github.com/yourname/github-link](https://github.com/dbader/) + +## Contributing + +1. Fork it () +2. Create your feature branch (`git checkout -b feature/fooBar`) +3. Commit your changes (`git commit -am 'Add some fooBar'`) +4. Push to the branch (`git push origin feature/fooBar`) +5. Create a new Pull Request + + +[npm-image]: https://img.shields.io/npm/v/datadog-metrics.svg?style=flat-square +[npm-url]: https://npmjs.org/package/datadog-metrics +[npm-downloads]: https://img.shields.io/npm/dm/datadog-metrics.svg?style=flat-square +[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square +[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics +[wiki]: https://github.com/yourname/yourproject/wiki diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 000000000..e69de29bb diff --git a/css/color.css b/css/color.css new file mode 100644 index 000000000..e69de29bb diff --git a/css/login.css b/css/login.css new file mode 100644 index 000000000..e69de29bb diff --git a/css/style.css b/css/style.css new file mode 100644 index 000000000..e69de29bb diff --git a/index.html b/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/js/function.js b/js/function.js new file mode 100644 index 000000000..e69de29bb diff --git a/js/script.js b/js/script.js new file mode 100644 index 000000000..e69de29bb diff --git a/js/utils.js b/js/utils.js new file mode 100644 index 000000000..e69de29bb diff --git a/login.html b/login.html new file mode 100644 index 000000000..e69de29bb diff --git a/signup.html b/signup.html new file mode 100644 index 000000000..e69de29bb From fd0ce50f53c89106c9ae8e15f480b8efeda39f35 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 12 Jul 2020 22:51:41 -0400 Subject: [PATCH 07/21] Added Readme, Login page, signup page, home page. --- MyREADME.md | 22 +++--- index.html | 151 ++++++++++++++++++++++++++++++++++++ login.html | 169 ++++++++++++++++++++++++++++++++++++++++ signup.html | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 548 insertions(+), 11 deletions(-) diff --git a/MyREADME.md b/MyREADME.md index e36767e55..30b897957 100644 --- a/MyREADME.md +++ b/MyREADME.md @@ -1,26 +1,26 @@ -# Product Name -> Short blurb about what your product does. +# Fired Chat Web APplication +> A web TCP full stack application that clients can send and recieve messages. [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Downloads Stats][npm-downloads]][npm-url] -One to two paragraph statement about your product and what it does. +Fired is a small full stack web application that enables it's users to chat with other clients. The application allows users to post on board without signing up. ![](header.png) -## Installation +## How to Access Fired -OS X & Linux: +Safari, Chrome, Firfox: ```sh -npm install my-crazy-module --save +Andriod, Install from Android app store ``` -Windows: +iOs: ```sh -edit autoexec.bat +install from appstore ``` ## Usage example @@ -55,11 +55,11 @@ npm test ## Meta -Your Name – [@YourTwitter](https://twitter.com/dbader_org) – YourEmail@example.com +Emmanuel Orubele – [@YourTwitter](https://twitter.com/####) – emmanuel.orubele@gmail.com -Distributed under the XYZ license. See ``LICENSE`` for more information. +Distributed under the Orubele.Inc license. See ``LICENSE`` for more information. -[https://github.com/yourname/github-link](https://github.com/dbader/) +[https://github.com/da7tysixers/](https://github.com/dbader/) ## Contributing diff --git a/index.html b/index.html index e69de29bb..9b3eb3260 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/login.html b/login.html index e69de29bb..f60ec6fdd 100644 --- a/login.html +++ b/login.html @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+
+ + +
+ +
+ + + + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/signup.html b/signup.html index e69de29bb..b9a65912c 100644 --- a/signup.html +++ b/signup.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ + +
+ Looks good! +
+
+
+ + +
+ Looks good! +
+
+
+ +
+
+ @ +
+ +
+ Please choose a username. +
+
+
+
+
+
+ + +
+ Please provide a valid city. +
+
+
+ + +
+ Please provide a valid state. +
+
+
+ + +
+ Please provide a valid zip. +
+
+
+
+
+ + +
+ You must agree before submitting. +
+
+
+ +
+ + + + + + + + + +
+ + + + + + + + \ No newline at end of file From 045b3d0167164a9fcdce2b075d4392abb87baffe Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Sun, 13 Sep 2020 22:51:14 -0400 Subject: [PATCH 08/21] Made Changes to file added login page thanks to Leon --- .gitignore | 562 ++++++++++++++++++ css/style.css | 0 index.html | 151 ----- kill-8080.bat | 1 + kill-8080.sh | 1 + login.html | 169 ------ pom.xml | 75 +++ signup.html | 217 ------- .../github/curriculeon/MainApplication.java | 11 + .../java/com/github/curriculeon/MyObject.java | 7 + .../curriculeon/config/WebSecurityConfig.java | 53 ++ .../controller/UserProfileController.java | 59 ++ .../github/curriculeon/model/UserProfile.java | 60 ++ .../curriculeon/model/UserProfileRole.java | 44 ++ .../repository/UserProfileRepository.java | 8 + .../repository/UserProfileRoleRepository.java | 8 + .../service/SecurityServiceImpl.java | 46 ++ .../service/UserProfileService.java | 51 ++ .../validator/UserProfileValidator.java | 42 ++ src/main/resources/application.properties | 7 + src/main/resources/validation.properties | 5 + src/main/webapp/footer.jsp | 4 + src/main/webapp/head_common.jsp | 11 + src/main/webapp/head_files.jsp | 10 + src/main/webapp/login.jsp | 35 ++ src/main/webapp/registration.jsp | 46 ++ .../main/webapp/resources/css}/color.css | 0 .../main/webapp/resources/css}/login.css | 0 src/main/webapp/resources/css/style.css | 43 ++ .../main/webapp/resources/js}/function.js | 0 .../main/webapp/resources/js}/script.js | 0 {js => src/main/webapp/resources/js}/utils.js | 0 src/main/webapp/welcome.jsp | 28 + .../com/github/curriculeon/MyObjectTest.java | 18 + 34 files changed, 1235 insertions(+), 537 deletions(-) create mode 100644 .gitignore delete mode 100644 css/style.css delete mode 100644 index.html create mode 100644 kill-8080.bat create mode 100644 kill-8080.sh delete mode 100644 login.html create mode 100644 pom.xml delete mode 100644 signup.html create mode 100644 src/main/java/com/github/curriculeon/MainApplication.java create mode 100644 src/main/java/com/github/curriculeon/MyObject.java create mode 100644 src/main/java/com/github/curriculeon/config/WebSecurityConfig.java create mode 100644 src/main/java/com/github/curriculeon/controller/UserProfileController.java create mode 100644 src/main/java/com/github/curriculeon/model/UserProfile.java create mode 100644 src/main/java/com/github/curriculeon/model/UserProfileRole.java create mode 100644 src/main/java/com/github/curriculeon/repository/UserProfileRepository.java create mode 100644 src/main/java/com/github/curriculeon/repository/UserProfileRoleRepository.java create mode 100644 src/main/java/com/github/curriculeon/service/SecurityServiceImpl.java create mode 100644 src/main/java/com/github/curriculeon/service/UserProfileService.java create mode 100644 src/main/java/com/github/curriculeon/validator/UserProfileValidator.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/validation.properties create mode 100644 src/main/webapp/footer.jsp create mode 100644 src/main/webapp/head_common.jsp create mode 100644 src/main/webapp/head_files.jsp create mode 100644 src/main/webapp/login.jsp create mode 100644 src/main/webapp/registration.jsp rename {css => src/main/webapp/resources/css}/color.css (100%) rename {css => src/main/webapp/resources/css}/login.css (100%) create mode 100644 src/main/webapp/resources/css/style.css rename {js => src/main/webapp/resources/js}/function.js (100%) rename {js => src/main/webapp/resources/js}/script.js (100%) rename {js => src/main/webapp/resources/js}/utils.js (100%) create mode 100644 src/main/webapp/welcome.jsp create mode 100644 src/test/java/com/github/curriculeon/MyObjectTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6161bf863 --- /dev/null +++ b/.gitignore @@ -0,0 +1,562 @@ + +# Created by https://www.gitignore.io/api/eclipse,intellij,netbeans,notepadpp,sublimetext,visualstudio +# Edit at https://www.gitignore.io/?templates=eclipse,intellij,netbeans,notepadpp,sublimetext,visualstudio + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +target +target/ +target/* +*.iml +.idea +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/**/sonarlint/ + +# SonarQube Plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator/ + +### NetBeans ### +**/nbproject/private/ +**/nbproject/Makefile-*.mk +**/nbproject/Package-*.bash +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +### NotepadPP ### +# Notepad++ backups # + +### SublimeText ### +# Cache files for Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# Workspace files are user-specific +*.sublime-workspace + +# Project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using Sublime Text +# *.sublime-project + +# SFTP configuration file +sftp-config.json + +# Package control specific files +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +Package Control.merged-ca-bundle +Package Control.user-ca-bundle +oscrypto-ca-bundle.crt +bh_unicode_properties.cache + +# Sublime-github package stores a github token in this file +# https://packagecontrol.io/packages/sublime-github +GitHub.sublime-settings + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# End of https://www.gitignore.io/api/eclipse,intellij,netbeans,notepadpp,sublimetext,visualstudio diff --git a/css/style.css b/css/style.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/index.html b/index.html deleted file mode 100644 index 9b3eb3260..000000000 --- a/index.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - \ No newline at end of file diff --git a/kill-8080.bat b/kill-8080.bat new file mode 100644 index 000000000..44b34ddda --- /dev/null +++ b/kill-8080.bat @@ -0,0 +1 @@ +for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a \ No newline at end of file diff --git a/kill-8080.sh b/kill-8080.sh new file mode 100644 index 000000000..2198716e0 --- /dev/null +++ b/kill-8080.sh @@ -0,0 +1 @@ +kill -kill `lsof -t -i tcp:8080` diff --git a/login.html b/login.html deleted file mode 100644 index f60ec6fdd..000000000 --- a/login.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
- - - We'll never share your email with anyone else. -
-
- - -
-
- - -
- -
- - - - - - - - - -
- - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..e58c5d923 --- /dev/null +++ b/pom.xml @@ -0,0 +1,75 @@ + + + 4.0.0 + SpringBootSampleWebApp + 0.0.1-SNAPSHOT + war + Curriculeon SpringBoot JSP Login Page + Demo project for Spring Boot With Login JSP View + + org.springframework.boot + spring-boot-starter-parent + 2.1.2.RELEASE + + + + UTF-8 + UTF-8 + 1.8 + + + + com.h2database + h2 + runtime + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.data + spring-data-jpa + + + javax.servlet + jstl + + + + org.apache.tomcat.embed + tomcat-embed-jasper + + + + org.eclipse.jdt.core.compiler + ecj + 4.6.1 + + + junit + junit + 4.12 + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/signup.html b/signup.html deleted file mode 100644 index b9a65912c..000000000 --- a/signup.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
- - -
- Looks good! -
-
-
- - -
- Looks good! -
-
-
- -
-
- @ -
- -
- Please choose a username. -
-
-
-
-
-
- - -
- Please provide a valid city. -
-
-
- - -
- Please provide a valid state. -
-
-
- - -
- Please provide a valid zip. -
-
-
-
-
- - -
- You must agree before submitting. -
-
-
- -
- - - - - - - - - -
- - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/github/curriculeon/MainApplication.java b/src/main/java/com/github/curriculeon/MainApplication.java new file mode 100644 index 000000000..93877b366 --- /dev/null +++ b/src/main/java/com/github/curriculeon/MainApplication.java @@ -0,0 +1,11 @@ +package com.github.curriculeon; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class MainApplication { + public static void main(String[] args) { + SpringApplication.run(MainApplication.class, args); + } +} diff --git a/src/main/java/com/github/curriculeon/MyObject.java b/src/main/java/com/github/curriculeon/MyObject.java new file mode 100644 index 000000000..2301f17e8 --- /dev/null +++ b/src/main/java/com/github/curriculeon/MyObject.java @@ -0,0 +1,7 @@ +package com.github.curriculeon; + +public class MyObject implements Runnable { + public void run() { + // TODO + } +} diff --git a/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java new file mode 100644 index 000000000..65f3c1402 --- /dev/null +++ b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java @@ -0,0 +1,53 @@ +package com.github.curriculeon.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +@Configuration +@EnableWebSecurity +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + @Autowired + private UserDetailsService userDetailsService; + + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .antMatchers("/resources/**", "/registration").permitAll() + .anyRequest().authenticated() + .and() + .formLogin() + .loginPage("/login") + .permitAll() + .and() + .logout() + .permitAll(); + } + + @Override + @Bean + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth + .parentAuthenticationManager(authenticationManagerBean()) + .userDetailsService(userDetailsService) + .passwordEncoder(bCryptPasswordEncoder()); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/curriculeon/controller/UserProfileController.java b/src/main/java/com/github/curriculeon/controller/UserProfileController.java new file mode 100644 index 000000000..3a5023f3c --- /dev/null +++ b/src/main/java/com/github/curriculeon/controller/UserProfileController.java @@ -0,0 +1,59 @@ +package com.github.curriculeon.controller; + +import com.github.curriculeon.model.UserProfile; +import com.github.curriculeon.service.SecurityServiceImpl; +import com.github.curriculeon.service.UserProfileService; +import com.github.curriculeon.validator.UserProfileValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +@Controller +public class UserProfileController { + private UserProfileService userService; + private SecurityServiceImpl securityService; + private UserProfileValidator userValidator; + + @Autowired + public UserProfileController(UserProfileService userService, UserProfileValidator userValidator, SecurityServiceImpl securityService) { + this.userService = userService; + this.userValidator = userValidator; + this.securityService = securityService; + } + + @GetMapping(value = "/registration") + public String registration(Model model) { + model.addAttribute("userForm", new UserProfile()); + return "registration"; + } + + @PostMapping(value = "/registration") + public String registration(@ModelAttribute("userForm") UserProfile userForm, BindingResult bindingResult, Model model) { + userValidator.validate(userForm, bindingResult); + if (bindingResult.hasErrors()) { + return "registration"; + } + userService.save(userForm); + securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirm()); + return "redirect:/welcome"; + } + + @GetMapping(value = "/login") + public String login(Model model, String error, String logout) { + if (error != null) { + model.addAttribute("error", "Your username and password are invalid."); + } + if (logout != null) { + model.addAttribute("message", "You have logged out successfully."); + } + + return "login"; + } + + @GetMapping(value = {"/", "/welcome"}) + public String welcome(Model model) { + return "welcome"; + } +} diff --git a/src/main/java/com/github/curriculeon/model/UserProfile.java b/src/main/java/com/github/curriculeon/model/UserProfile.java new file mode 100644 index 000000000..833c836c2 --- /dev/null +++ b/src/main/java/com/github/curriculeon/model/UserProfile.java @@ -0,0 +1,60 @@ +package com.github.curriculeon.model; + +import javax.persistence.*; +import java.util.List; + +@Entity +public class UserProfile { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String username; + private String password; + + @Transient // don't persist; not a column + private String passwordConfirm; + + @ManyToMany + @ElementCollection + private List userRoles; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getPasswordConfirm() { + return passwordConfirm; + } + + public void setPasswordConfirm(String passwordConfirm) { + this.passwordConfirm = passwordConfirm; + } + + public List getUserRoles() { + return userRoles; + } + + public void setUserRoles(List userRoles) { + this.userRoles = userRoles; + } +} diff --git a/src/main/java/com/github/curriculeon/model/UserProfileRole.java b/src/main/java/com/github/curriculeon/model/UserProfileRole.java new file mode 100644 index 000000000..2838c81d7 --- /dev/null +++ b/src/main/java/com/github/curriculeon/model/UserProfileRole.java @@ -0,0 +1,44 @@ +package com.github.curriculeon.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import javax.persistence.*; +import java.util.List; + +@Entity +public class UserProfileRole { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String name; + + @JsonIgnore + @ManyToMany + @ElementCollection + private List users; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getUsers() { + return users; + } + + public void setUsers(List users) { + this.users = users; + } +} diff --git a/src/main/java/com/github/curriculeon/repository/UserProfileRepository.java b/src/main/java/com/github/curriculeon/repository/UserProfileRepository.java new file mode 100644 index 000000000..ae6bc3828 --- /dev/null +++ b/src/main/java/com/github/curriculeon/repository/UserProfileRepository.java @@ -0,0 +1,8 @@ +package com.github.curriculeon.repository; + +import com.github.curriculeon.model.UserProfile; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserProfileRepository extends JpaRepository { + UserProfile findByUsername(String username); +} diff --git a/src/main/java/com/github/curriculeon/repository/UserProfileRoleRepository.java b/src/main/java/com/github/curriculeon/repository/UserProfileRoleRepository.java new file mode 100644 index 000000000..552c67eb3 --- /dev/null +++ b/src/main/java/com/github/curriculeon/repository/UserProfileRoleRepository.java @@ -0,0 +1,8 @@ +package com.github.curriculeon.repository; + + +import com.github.curriculeon.model.UserProfileRole; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserProfileRoleRepository extends JpaRepository { +} diff --git a/src/main/java/com/github/curriculeon/service/SecurityServiceImpl.java b/src/main/java/com/github/curriculeon/service/SecurityServiceImpl.java new file mode 100644 index 000000000..fbe42fd48 --- /dev/null +++ b/src/main/java/com/github/curriculeon/service/SecurityServiceImpl.java @@ -0,0 +1,46 @@ +package com.github.curriculeon.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.stereotype.Service; + +@Service +public class SecurityServiceImpl { + private static final Logger logger = LoggerFactory.getLogger(SecurityServiceImpl.class); + private AuthenticationManager authenticationManager; + + private UserDetailsService userDetailsService; + + @Autowired + public SecurityServiceImpl(AuthenticationManager authenticationManager, UserDetailsService userDetailsService) { + this.authenticationManager = authenticationManager; + this.userDetailsService = userDetailsService; + } + + public String findLoggedInUsername() { + Object userDetails = SecurityContextHolder.getContext().getAuthentication().getDetails(); + if (userDetails instanceof UserDetails) { + return ((UserDetails) userDetails).getUsername(); + } + + return null; + } + + public void autologin(String username, String password) { + UserDetails userDetails = userDetailsService.loadUserByUsername(username); + UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); + + authenticationManager.authenticate(usernamePasswordAuthenticationToken); + + if (usernamePasswordAuthenticationToken.isAuthenticated()) { + SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); + logger.debug(String.format("Auto login %s successfully!", username)); + } + } +} diff --git a/src/main/java/com/github/curriculeon/service/UserProfileService.java b/src/main/java/com/github/curriculeon/service/UserProfileService.java new file mode 100644 index 000000000..e278f01fa --- /dev/null +++ b/src/main/java/com/github/curriculeon/service/UserProfileService.java @@ -0,0 +1,51 @@ +package com.github.curriculeon.service; + +import com.github.curriculeon.model.UserProfile; +import com.github.curriculeon.repository.UserProfileRoleRepository; +import com.github.curriculeon.repository.UserProfileRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashSet; +import java.util.Set; + +@Service +public class UserProfileService implements UserDetailsService { + private UserProfileRepository userRepository; + private UserProfileRoleRepository roleRepository; + private BCryptPasswordEncoder bCryptPasswordEncoder; + + @Autowired + public UserProfileService(UserProfileRepository userRepository, UserProfileRoleRepository roleRepository, BCryptPasswordEncoder bCryptPasswordEncoder) { + this.userRepository = userRepository; + this.roleRepository = roleRepository; + this.bCryptPasswordEncoder = bCryptPasswordEncoder; + } + + @Override + @Transactional(readOnly = true) + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + UserProfile user = userRepository.findByUsername(username); + Set grantedAuthorities = new HashSet<>(); + user.getUserRoles().forEach(role -> grantedAuthorities.add(new SimpleGrantedAuthority(role.getName()))); + return new User(user.getUsername(), user.getPassword(), grantedAuthorities); + } + + public void save(UserProfile user) { + user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); + user.setUserRoles(roleRepository.findAll()); + userRepository.save(user); + } + + public UserProfile findByUsername(String username) { + return userRepository.findByUsername(username); + } +} diff --git a/src/main/java/com/github/curriculeon/validator/UserProfileValidator.java b/src/main/java/com/github/curriculeon/validator/UserProfileValidator.java new file mode 100644 index 000000000..50b95b417 --- /dev/null +++ b/src/main/java/com/github/curriculeon/validator/UserProfileValidator.java @@ -0,0 +1,42 @@ +package com.github.curriculeon.validator; + +import com.github.curriculeon.model.UserProfile; +import com.github.curriculeon.service.UserProfileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.validation.Errors; +import org.springframework.validation.ValidationUtils; +import org.springframework.validation.Validator; + +@Component +public class UserProfileValidator implements Validator { + @Autowired + private UserProfileService userService; + + @Override + public boolean supports(Class aClass) { + return UserProfile.class.equals(aClass); + } + + @Override + public void validate(Object o, Errors errors) { + UserProfile user = (UserProfile) o; + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "NotEmpty"); + if (user.getUsername().length() < 6 || user.getUsername().length() > 32) { + errors.rejectValue("username", "Size.userForm.username"); + } + if (userService.findByUsername(user.getUsername()) != null) { + errors.rejectValue("username", "Duplicate.userForm.username"); + } + + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "NotEmpty"); + if (user.getPassword().length() < 8 || user.getPassword().length() > 32) { + errors.rejectValue("password", "Size.userForm.password"); + } + + if (!user.getPasswordConfirm().equals(user.getPassword())) { + errors.rejectValue("passwordConfirm", "Diff.userForm.passwordConfirm"); + } + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 000000000..d5fcfa691 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,7 @@ +spring.mvc.view.prefix: / +spring.mvc.view.suffix: .jsp +spring.messages.basename=validation + +spring.datasource.username=root +spring.datasource.password=root + diff --git a/src/main/resources/validation.properties b/src/main/resources/validation.properties new file mode 100644 index 000000000..9309bdf06 --- /dev/null +++ b/src/main/resources/validation.properties @@ -0,0 +1,5 @@ +NotEmpty=This field is required. +Size.userForm.username=Username require between 6 and 32 characters. +Duplicate.userForm.username=Someone is already using this username. +Size.userForm.password=Passwords require at least 8 characters. +Diff.userForm.passwordConfirm=These passwords do not match. \ No newline at end of file diff --git a/src/main/webapp/footer.jsp b/src/main/webapp/footer.jsp new file mode 100644 index 000000000..9cbb80181 --- /dev/null +++ b/src/main/webapp/footer.jsp @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/webapp/head_common.jsp b/src/main/webapp/head_common.jsp new file mode 100644 index 000000000..196e10bcc --- /dev/null +++ b/src/main/webapp/head_common.jsp @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/head_files.jsp b/src/main/webapp/head_files.jsp new file mode 100644 index 000000000..9c9626c3c --- /dev/null +++ b/src/main/webapp/head_files.jsp @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp new file mode 100644 index 000000000..ccce5f0c8 --- /dev/null +++ b/src/main/webapp/login.jsp @@ -0,0 +1,35 @@ +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + + + + + Log in with your account + + + +
+
+
+ + + +
+
+
+ diff --git a/src/main/webapp/registration.jsp b/src/main/webapp/registration.jsp new file mode 100644 index 000000000..a4e886276 --- /dev/null +++ b/src/main/webapp/registration.jsp @@ -0,0 +1,46 @@ +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> + + + + + + Create an account + + + +
+
+
+ + + +
+
+
+ diff --git a/css/color.css b/src/main/webapp/resources/css/color.css similarity index 100% rename from css/color.css rename to src/main/webapp/resources/css/color.css diff --git a/css/login.css b/src/main/webapp/resources/css/login.css similarity index 100% rename from css/login.css rename to src/main/webapp/resources/css/login.css diff --git a/src/main/webapp/resources/css/style.css b/src/main/webapp/resources/css/style.css new file mode 100644 index 000000000..aaf492b73 --- /dev/null +++ b/src/main/webapp/resources/css/style.css @@ -0,0 +1,43 @@ +body { + font-family: 'Montserrat', "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 15px; + padding-top: 50px; + padding-bottom: 50px; + background-color: #efefef; + color: #2b2b2b; +} +.form-heading { + text-align: center; + text-transform: uppercase; +} +.form-signin { + max-width: 360px; + padding: 15px; + margin: 0 auto; +} +.form-signin .form-control { + position: relative; + height: auto; + padding: 10px; + font-size: 15px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.form-signin .form-control:focus { + z-index: 3; +} +.form-signin input, .form-signin button { + margin-top: 10px; +} +.form-signin .form-signin-heading, .form-signin .checkbox { + margin-bottom: 10px; +} +.form-signin .checkbox { + font-weight: normal; +} +.has-error { + color: #ff0000; + line-height: 1; + font-size: 14px; +} \ No newline at end of file diff --git a/js/function.js b/src/main/webapp/resources/js/function.js similarity index 100% rename from js/function.js rename to src/main/webapp/resources/js/function.js diff --git a/js/script.js b/src/main/webapp/resources/js/script.js similarity index 100% rename from js/script.js rename to src/main/webapp/resources/js/script.js diff --git a/js/utils.js b/src/main/webapp/resources/js/utils.js similarity index 100% rename from js/utils.js rename to src/main/webapp/resources/js/utils.js diff --git a/src/main/webapp/welcome.jsp b/src/main/webapp/welcome.jsp new file mode 100644 index 000000000..8284ea345 --- /dev/null +++ b/src/main/webapp/welcome.jsp @@ -0,0 +1,28 @@ +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + Create an account + + + +
+
+
+ + +
+ +
+ +

Welcome ${pageContext.request.userPrincipal.name} | Logout

+ +
+ +
+
+
+ diff --git a/src/test/java/com/github/curriculeon/MyObjectTest.java b/src/test/java/com/github/curriculeon/MyObjectTest.java new file mode 100644 index 000000000..2eac71dd4 --- /dev/null +++ b/src/test/java/com/github/curriculeon/MyObjectTest.java @@ -0,0 +1,18 @@ +package com.github.curriculeon; + +import org.junit.Assert; +import org.junit.Test; + +public class MyObjectTest { + @Test + public void testRun() { // TODO + // Given + MyObject myObject = new MyObject(); + + // when + myObject.run(); + + //then + Assert.assertNotNull(myObject.toString()); + } +} From 72e979918f46b8b4c0cee8c243c4266ef1376d03 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Mon, 14 Sep 2020 13:17:33 -0400 Subject: [PATCH 09/21] Added welcom page --- .../curriculeon/controller/UserProfileController.java | 7 +++++++ src/main/webapp/home.jsp | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/main/webapp/home.jsp diff --git a/src/main/java/com/github/curriculeon/controller/UserProfileController.java b/src/main/java/com/github/curriculeon/controller/UserProfileController.java index 3a5023f3c..8086458a5 100644 --- a/src/main/java/com/github/curriculeon/controller/UserProfileController.java +++ b/src/main/java/com/github/curriculeon/controller/UserProfileController.java @@ -5,6 +5,7 @@ import com.github.curriculeon.service.UserProfileService; import com.github.curriculeon.validator.UserProfileValidator; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; @@ -40,6 +41,12 @@ public String registration(@ModelAttribute("userForm") UserProfile userForm, Bin return "redirect:/welcome"; } + @GetMapping(value ="/home") + String getView(Model model) { + model.addAttribute("msg", "Hello there, This message has been injected from the controller method"); + return "home"; + } + @GetMapping(value = "/login") public String login(Model model, String error, String logout) { if (error != null) { diff --git a/src/main/webapp/home.jsp b/src/main/webapp/home.jsp new file mode 100644 index 000000000..6f8ba2113 --- /dev/null +++ b/src/main/webapp/home.jsp @@ -0,0 +1,11 @@ + +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + +

${msg}

+ Login + + From becdcaebe13548a007c216d636d065a4628e196a Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Tue, 15 Sep 2020 00:40:27 -0400 Subject: [PATCH 10/21] added todo-List page to my file --- pom.xml | 15 +++++ .../curriculeon/config/WebSecurityConfig.java | 5 +- .../controller/UserProfileController.java | 5 +- .../com/github/curriculeon/model/Todo.java | 62 +++++++++++++++++++ .../repository/TodoRepository.java | 11 ++++ src/main/webapp/error.jsp | 0 src/main/webapp/home.jsp | 28 ++++++--- src/main/webapp/list-todos.jsp | 0 src/main/webapp/todo.jsp | 0 9 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/github/curriculeon/model/Todo.java create mode 100644 src/main/java/com/github/curriculeon/repository/TodoRepository.java create mode 100644 src/main/webapp/error.jsp create mode 100644 src/main/webapp/list-todos.jsp create mode 100644 src/main/webapp/todo.jsp diff --git a/pom.xml b/pom.xml index e58c5d923..563de95e0 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,21 @@ ecj 4.6.1 + + org.webjars + jquery + 3.4.0 + + + org.webjars + bootstrap-datepicker + 1.9.0 + + + org.webjars + bootstrap + 4.5.2 + junit junit diff --git a/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java index 65f3c1402..b39e4b106 100644 --- a/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java +++ b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java @@ -26,14 +26,15 @@ public BCryptPasswordEncoder bCryptPasswordEncoder() { protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() + .antMatchers("/home").permitAll() .antMatchers("/resources/**", "/registration").permitAll() .anyRequest().authenticated() .and() - .formLogin() + .formLogin() .loginPage("/login") .permitAll() .and() - .logout() + .logout() .permitAll(); } diff --git a/src/main/java/com/github/curriculeon/controller/UserProfileController.java b/src/main/java/com/github/curriculeon/controller/UserProfileController.java index 8086458a5..defc71b53 100644 --- a/src/main/java/com/github/curriculeon/controller/UserProfileController.java +++ b/src/main/java/com/github/curriculeon/controller/UserProfileController.java @@ -41,8 +41,9 @@ public String registration(@ModelAttribute("userForm") UserProfile userForm, Bin return "redirect:/welcome"; } - @GetMapping(value ="/home") - String getView(Model model) { + // recently added + @GetMapping("/home") + public String getView(Model model) { model.addAttribute("msg", "Hello there, This message has been injected from the controller method"); return "home"; } diff --git a/src/main/java/com/github/curriculeon/model/Todo.java b/src/main/java/com/github/curriculeon/model/Todo.java new file mode 100644 index 000000000..c5b0e676d --- /dev/null +++ b/src/main/java/com/github/curriculeon/model/Todo.java @@ -0,0 +1,62 @@ +package com.github.curriculeon.model; + + +import javax.persistence.*; +import javax.validation.constraints.Size; +import javax.xml.stream.events.Characters; +import java.util.Date; + +@Entity +@Table(name = "todo_list") +public class Todo { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + + private String userName; + + @Size(min = 10, message = "Enter at least 10 Characters...") + private String description; + + private Date targetDate; + + public Todo(String userName,String description, Date targetDate) { + super(); + this.userName = userName; + this.description = description; + this.targetDate = targetDate; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getTargetDate() { + return targetDate; + } + + public void setTargetDate(Date targetDate) { + this.targetDate = targetDate; + } +} diff --git a/src/main/java/com/github/curriculeon/repository/TodoRepository.java b/src/main/java/com/github/curriculeon/repository/TodoRepository.java new file mode 100644 index 000000000..d4132d77a --- /dev/null +++ b/src/main/java/com/github/curriculeon/repository/TodoRepository.java @@ -0,0 +1,11 @@ +package com.github.curriculeon.repository; + +import com.github.curriculeon.model.Todo; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TodoRepository extends JpaRepository { + + List findByUserName(String user); +} diff --git a/src/main/webapp/error.jsp b/src/main/webapp/error.jsp new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/webapp/home.jsp b/src/main/webapp/home.jsp index 6f8ba2113..45fdca478 100644 --- a/src/main/webapp/home.jsp +++ b/src/main/webapp/home.jsp @@ -1,11 +1,21 @@ - -<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib uri = "http://www.springframework.org/tags/form" prefix = "form"%> + + - - -

${msg}

- Login - - + Log in with your account + + +

Spring Page Redirection

+

${msg}

+

Click below button to redirect the result to new page

+ + + + + + +
+ +
+
diff --git a/src/main/webapp/list-todos.jsp b/src/main/webapp/list-todos.jsp new file mode 100644 index 000000000..e69de29bb diff --git a/src/main/webapp/todo.jsp b/src/main/webapp/todo.jsp new file mode 100644 index 000000000..e69de29bb From 70847ab9d853b81be554e9a2d0927c85cdf481c0 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Thu, 17 Sep 2020 00:21:38 -0400 Subject: [PATCH 11/21] Finished with controller, models, and config --- .../controller/ErrorController.java | 22 +++++ .../controller/TodoController.java | 98 +++++++++++++++++++ .../com/github/curriculeon/model/Todo.java | 7 +- .../curriculeon/service/ITodoService.java | 21 ++++ .../curriculeon/service/TodoService.java | 52 ++++++++++ src/main/resources/application.properties | 6 ++ src/main/webapp/footer.jsp | 84 ++++++++++++++++ src/main/webapp/head_common.jsp | 3 +- src/main/webapp/home.jsp | 69 ++++++++++--- src/main/webapp/resources/css/style.css | 4 +- src/main/webapp/welcome.jsp | 1 + 11 files changed, 350 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/github/curriculeon/controller/ErrorController.java create mode 100644 src/main/java/com/github/curriculeon/controller/TodoController.java create mode 100644 src/main/java/com/github/curriculeon/service/ITodoService.java create mode 100644 src/main/java/com/github/curriculeon/service/TodoService.java diff --git a/src/main/java/com/github/curriculeon/controller/ErrorController.java b/src/main/java/com/github/curriculeon/controller/ErrorController.java new file mode 100644 index 000000000..61c6961be --- /dev/null +++ b/src/main/java/com/github/curriculeon/controller/ErrorController.java @@ -0,0 +1,22 @@ +package com.github.curriculeon.controller; + + +import org.springframework.stereotype.Controller; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; + +@Controller("error") +public class ErrorController { + public ModelAndView handleException(HttpServletRequest request, Exception ex){ + ModelAndView modelAndView = new ModelAndView(); + + modelAndView.addObject("exception", ex.getLocalizedMessage()); + modelAndView.addObject("url", request.getRequestURL()); + + modelAndView.setViewName("error"); + + return modelAndView; + } + +} diff --git a/src/main/java/com/github/curriculeon/controller/TodoController.java b/src/main/java/com/github/curriculeon/controller/TodoController.java new file mode 100644 index 000000000..95804703d --- /dev/null +++ b/src/main/java/com/github/curriculeon/controller/TodoController.java @@ -0,0 +1,98 @@ +package com.github.curriculeon.controller; + + +import com.github.curriculeon.model.Todo; +import com.github.curriculeon.service.TodoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.validation.Valid; +import java.text.SimpleDateFormat; +import java.util.Date; + +@Controller +public class TodoController { + + @Autowired + private TodoService todoService; + + @InitBinder + public void initBinder(WebDataBinder binder){ + // Date - dd/mm/yyyy + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + binder.registerCustomEditor(Date.class, + new CustomDateEditor(dateFormat,false)); + } + + @RequestMapping(value = "/list-todos", method = RequestMethod.GET) + public String showTodo(ModelMap model) { + String name = getLoggedInUserName(model); + model.put("todos",todoService.getTodoByUser(name)); + // model insert to do service + return "list-todos"; + } + + private String getLoggedInUserName(ModelMap model) { + Object principal = SecurityContextHolder + .getContext() + .getAuthentication() + .getPrincipal(); + if (principal instanceof UserDetails){ + return ((UserDetails) principal).getUsername(); + } + + return principal.toString(); + } + + @RequestMapping(value = "/add-todo", method = RequestMethod.GET) + public String showAddTodoPage(ModelMap model){ + model.addAttribute("todos", new Todo()); + return "todo"; + } + + @RequestMapping(value = "/delete-todo", method = RequestMethod.GET) + public String deleteTodo(@RequestParam long id){ + todoService.deleteTodo(id); + return "redirect:/list-todos"; + } + + @RequestMapping(value = "/update-todo", method = RequestMethod.GET) + public String showUpdateTodoPage(@RequestParam long id, ModelMap model){ + Todo todo = todoService.getTodoById(id).get(); + model.put("todo", todo); + return "todo"; + } + + @RequestMapping(value = "/update-todo", method = RequestMethod.POST) + public String updateTodo(ModelMap model, @Valid Todo todo, BindingResult result){ + + if (result.hasErrors()) { + return "todo"; + } + + todo.setUserName(getLoggedInUserName(model)); + todoService.updateTodo(todo); + return "redirect:/list-todos"; + } + + @RequestMapping(value = "/add-todo", method = RequestMethod.POST) + public String addTodo(ModelMap model, @Valid Todo todo, BindingResult result){ + if (result.hasErrors()){ + return "todo"; + } + todo.setUserName(getLoggedInUserName(model)); + todoService.saveTodo(todo); + return "redirect:/list-todos"; + } + +} diff --git a/src/main/java/com/github/curriculeon/model/Todo.java b/src/main/java/com/github/curriculeon/model/Todo.java index c5b0e676d..e09e03e7b 100644 --- a/src/main/java/com/github/curriculeon/model/Todo.java +++ b/src/main/java/com/github/curriculeon/model/Todo.java @@ -3,7 +3,6 @@ import javax.persistence.*; import javax.validation.constraints.Size; -import javax.xml.stream.events.Characters; import java.util.Date; @Entity @@ -21,7 +20,11 @@ public class Todo { private Date targetDate; - public Todo(String userName,String description, Date targetDate) { + public Todo(){ + super(); + } + + public Todo(String userName,String description, Date targetDate, boolean isDone) { super(); this.userName = userName; this.description = description; diff --git a/src/main/java/com/github/curriculeon/service/ITodoService.java b/src/main/java/com/github/curriculeon/service/ITodoService.java new file mode 100644 index 000000000..44866d319 --- /dev/null +++ b/src/main/java/com/github/curriculeon/service/ITodoService.java @@ -0,0 +1,21 @@ +package com.github.curriculeon.service; + +import com.github.curriculeon.model.Todo; + +import java.util.Date; +import java.util.List; +import java.util.Optional; + +public interface ITodoService { + List getTodoByUser(String user); + + Optional getTodoById(long id); + + void updateTodo(Todo todo); + + void addTodo(String name, String desc, Date targetDate, boolean isDone); + + void deleteTodo(long id); + + void saveTodo(Todo todo); +} diff --git a/src/main/java/com/github/curriculeon/service/TodoService.java b/src/main/java/com/github/curriculeon/service/TodoService.java new file mode 100644 index 000000000..2c1c52955 --- /dev/null +++ b/src/main/java/com/github/curriculeon/service/TodoService.java @@ -0,0 +1,52 @@ +package com.github.curriculeon.service; + + +import com.github.curriculeon.model.Todo; +import com.github.curriculeon.repository.TodoRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.Optional; + +@Service +public class TodoService implements ITodoService { + + @Autowired + private TodoRepository repository; + + @Override + public List getTodoByUser(String user){ + return repository.findByUserName(user); + } + + @Override + public Optional getTodoById(long id){ + return repository.findById(id); + } + + @Override + public void updateTodo(Todo todo){ + repository.save(todo); + } + + @Override + public void addTodo(String name, String desc, Date targetDate, boolean isDone){ + repository.save(new Todo(name, desc, targetDate, isDone)); + } + + @Override + public void deleteTodo(long id){ + Optional todo = repository.findById(id); + if (todo.isPresent()){ + repository.delete(todo.get()); + } + } + + @Override + public void saveTodo(Todo todo){ + repository.save(todo); + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d5fcfa691..d790e93bf 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -5,3 +5,9 @@ spring.messages.basename=validation spring.datasource.username=root spring.datasource.password=root +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=update diff --git a/src/main/webapp/footer.jsp b/src/main/webapp/footer.jsp index 9cbb80181..579ff5453 100644 --- a/src/main/webapp/footer.jsp +++ b/src/main/webapp/footer.jsp @@ -1,4 +1,88 @@ + + +
+ + + + + + + + + +
+ \ No newline at end of file diff --git a/src/main/webapp/head_common.jsp b/src/main/webapp/head_common.jsp index 196e10bcc..7aeb4ef65 100644 --- a/src/main/webapp/head_common.jsp +++ b/src/main/webapp/head_common.jsp @@ -8,4 +8,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/src/main/webapp/home.jsp b/src/main/webapp/home.jsp index 45fdca478..acc1c6622 100644 --- a/src/main/webapp/home.jsp +++ b/src/main/webapp/home.jsp @@ -3,19 +3,62 @@ - Log in with your account + Todo List -

Spring Page Redirection

-

${msg}

-

Click below button to redirect the result to new page

+ + + + +
+
+
+

Fixed Full Page Background Image

+

In this snippet, the background image is fixed to the body element. Content on the page will scroll, but the image will remain in a fixed position!

+ + + + + +
+ +
+
+

Scroll down...

+
+

You've reached the end!

+
+
+
+ + - - - - - -
- -
-
diff --git a/src/main/webapp/resources/css/style.css b/src/main/webapp/resources/css/style.css index aaf492b73..cc733322c 100644 --- a/src/main/webapp/resources/css/style.css +++ b/src/main/webapp/resources/css/style.css @@ -40,4 +40,6 @@ body { color: #ff0000; line-height: 1; font-size: 14px; -} \ No newline at end of file +} + + diff --git a/src/main/webapp/welcome.jsp b/src/main/webapp/welcome.jsp index 8284ea345..41eae2652 100644 --- a/src/main/webapp/welcome.jsp +++ b/src/main/webapp/welcome.jsp @@ -20,6 +20,7 @@

Welcome ${pageContext.request.userPrincipal.name} | Logout

+ From 9fd9a00e44d90b5380ff02861dcffb16ecb64375 Mon Sep 17 00:00:00 2001 From: Emmanuel Orubele Date: Thu, 17 Sep 2020 19:27:19 -0400 Subject: [PATCH 12/21] Completed controller classes --- pom.xml | 7 +- .../curriculeon/config/WebSecurityConfig.java | 2 +- .../com/github/curriculeon/model/Todo.java | 3 +- src/main/webapp/error.jsp | 15 +++++ src/main/webapp/footer.jsp | 13 +++- src/main/webapp/head_common.jsp | 5 ++ src/main/webapp/list-todos.jsp | 45 +++++++++++++ src/main/webapp/navigation.jsp | 40 +++++++++++ src/main/webapp/todo.jsp | 35 ++++++++++ src/main/webapp/welcome.jsp | 67 ++++++++++++++++--- 10 files changed, 217 insertions(+), 15 deletions(-) create mode 100644 src/main/webapp/navigation.jsp diff --git a/pom.xml b/pom.xml index 563de95e0..a5eecd48c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 SpringBootSampleWebApp 0.0.1-SNAPSHOT - war + jar Curriculeon SpringBoot JSP Login Page Demo project for Spring Boot With Login JSP View @@ -78,6 +78,11 @@ 4.12 test
+ + org.springframework.security + spring-security-test + test + diff --git a/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java index b39e4b106..66f5b6974 100644 --- a/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java +++ b/src/main/java/com/github/curriculeon/config/WebSecurityConfig.java @@ -30,7 +30,7 @@ protected void configure(HttpSecurity http) throws Exception { .antMatchers("/resources/**", "/registration").permitAll() .anyRequest().authenticated() .and() - .formLogin() + .formLogin().defaultSuccessUrl("/resources/**") .loginPage("/login") .permitAll() .and() diff --git a/src/main/java/com/github/curriculeon/model/Todo.java b/src/main/java/com/github/curriculeon/model/Todo.java index e09e03e7b..89c4975b1 100644 --- a/src/main/java/com/github/curriculeon/model/Todo.java +++ b/src/main/java/com/github/curriculeon/model/Todo.java @@ -10,8 +10,7 @@ public class Todo { @Id @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - + private long id; private String userName; diff --git a/src/main/webapp/error.jsp b/src/main/webapp/error.jsp index e69de29bb..6aad14e95 100644 --- a/src/main/webapp/error.jsp +++ b/src/main/webapp/error.jsp @@ -0,0 +1,15 @@ + + +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + Error + +
+ An exception occurred! Please technical support! +
+ + + \ No newline at end of file diff --git a/src/main/webapp/footer.jsp b/src/main/webapp/footer.jsp index 579ff5453..4cd52d0d0 100644 --- a/src/main/webapp/footer.jsp +++ b/src/main/webapp/footer.jsp @@ -1,5 +1,14 @@ + + + + +