Skip to content

masterujjval/Postgres_Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Register-Login-Update website

About

Login-form-validation is a simple website that can run locally on any platform. The user can register and then log in then land on the greeting page, it will store data on Postgresql locally to validate the registered users during the login process.

Postgresql for database, express for fetch, and post and node have been used to create this project.

Screenshot from 2023-07-29 16-38-24

Screenshot from 2023-07-29 16-35-41

Screenshot from 2023-07-29 16-38-50

Screenshot from 2023-07-29 16-38-30

Update your password

The password can be updated with the registered email. Enter your registered email and then enter a new password after successfully updating the password it will redirect the user to the login page. Here, enter the email and the newly updated password and then the user can successfully log in.

Screenshot from 2023-08-21 17-22-01

Screenshot from 2023-08-21 17-22-09


Prerequisite to run the website and server

  • Postgresql

  • NodeJs

  • Knex.js

  • To install Postgresql watch these tutorials for

Changes to be made after setup up the environment

Now to create a database to store registration and then for validation, we have to first create a database. After, successfully installing Postgresql made some changes:-

Screenshot from 2023-07-29 17-09-09

Change the password and enter your password which was entered while creating a server with username postgres.


Open the folder in vs code where you have cloned the project and follow the below steps to create a database:

For Linux

sudo -i -u postgres

Screenshot from 2023-07-29 17-19-01

Now create a database and name it 'loginform1'

createdb loginform

Screenshot from 2023-07-29 17-25-28

Now, switch to loginform1 database to create table

psql -d loginform1

Screenshot from 2023-07-29 17-30-12

Now copy the below lines to create a table to register users

CREATE TABLE users (id serial not null primary key, name varchar(255) not null, email varchar(255) not null unique, password varchar(255) not null);

run : SELECT * FROM users; to check whether the table is created or not.

Now you can run the project on your Linux.


For Windows

run: psql -U postgres then enter the password you have entered while creating a server with username postgres

Create database: CREATE DATABASE loginform1

switch to database: \c loginform1

then copy the same command for creating a table:

CREATE TABLE users (id serial not null primary key, name varchar(255) not null, email varchar(255) not null unique, password varchar(255) not null);

Execute npm start in the vs code terminal to run the server.

Update.js file does not have any role in running all the files it is just to understand the update query. It can be run using node update.js in the terminal separately.

About

User Authentication using Postgres as Database

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published