Giter Site home page Giter Site logo

alexkmj / login-application Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 198 KB

This is a simple login application that allows users to login and access a welcome page. Managers can also access a restricted page and set other users as managers.

Java 60.46% HTML 8.87% JavaScript 30.66%
java spring-boot spring-security

login-application's Introduction

Login Application

Java CI with Maven

Welcome to the Login Application! This is a simple login application that allows users to login and access a welcome page. Managers can also access a restricted page and set other users as managers.

This documentation might be a bit verbose, but this is to ensure that the code is as clear as possible.

Getting Started

To get started, first ensure you have Maven installed. Then run the following command:

mvn spring-boot:run

This will start the application on port 8080. You can then navigate to http://localhost:8080/ to access the home page. The application will also create two users, namely user and admin. Both users have the password password.

If you prefer, you can also set up the application in your preferred IDE and run it from there.

Screenshots

Here are some screenshots of the Login Application:

Click to view Screenshots

Home Page

Home Page

Signup Page

Signup Page

Login Page

Login Page

Logout Page

Logout Page

Welcome Page

Welcome Page

Restricted Page

Restricted Page

Pages

The Login Application has the following pages:

  • / - Home page that can be accessed by anyone
  • /login - Login page
  • /logout - Logout page
  • /welcome - Welcome page that can only be accessed by logged in users
  • /restricted - Restricted page that can only be accessed by managers
  • /signup - Signup page that allows users to create a new account

Stack

The backend is written in Java using Spring Boot. Specifically, Spring Boot Web and Spring Boot Security are used. The frontend is written in HTML and CSS with the help of React.js and Material UI.

Explaination

The application is a simple login application that allows users to login and access a welcome page. Managers can also access a restricted page. Managers can also set other users as managers. The application uses Spring Boot Security to handle authentication and authorization. The application uses h2 as a database to store users and their roles. The application uses React.js and Material UI to create the frontend. The application uses Spring Boot Web to create the REST API endpoints.

Pages

  • / - Home page that can be accessed by anyone
  • /login - Login page
  • /logout - Logout page
  • /welcome - Welcome page that can only be accessed by logged in users
  • /restricted - Restricted page that can only be accessed by managers
  • /signup - Signup page that allows users to create a new account

API

The Login Application has the following API endpoints:

API Method Roles Description
/api/v1/users GET ROLE_USER Get user information
/api/v1/users POST None Create a new user
/api/v1/users PUT ROLE_MANAGER Update a user
/api/v1/all-users GET ROLE_MANAGER Get all users

Internationalization Frameworks

React-i18next

For internationalization, the application could have used react-i18next which is a popular internationalization framework for React.js. However, I did not use this framework because I wanted to keep the application as simple as possible.

The t function wraps the text that needs to be translated. The t function can take in a string or a string and the namespace. The namespace are the context of the string. If no namespace is provided, the default namespace is used.

Others

Alternatively, other frameworks could be used. The procedure is similar to react-i18next. There is generally a wrapper function that wraps the text that needs to be translated. The wrapper function can take in a string to be translated as well as the context. Sometimes, the framework provides a tool to extract the strings that need to be translated which allows us to update the translation files.

login-application's People

Contributors

alexkmj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.