Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 1.63 KB

README.md

File metadata and controls

128 lines (92 loc) · 1.63 KB

login

Simple login module using the Java Spark Framework

API

When the API requires you to be logged in or if authentication fails in some way it will return a Status code of 401. If there is information missing in a request it will return a Status of 400. Internal errors will result in Status of 500.

Sign-Up

Request:

POST /sign-up

{
  "username":"[email protected]", 
  "password":"test", 
  "info": "Hello World!"
}

Response:

Status: 200 OK
{}

Login

Request:

POST /login

{
  "username":"[email protected]", 
  "password":"test"
}

Response:

Status: 200 OK
{"session":"5b30b1a4-31db-46e4-b359-9e726ccb681b"}

View Profile

This will either return the profile information or a 404

Request:

GET /profile/:user

Response:

Status: 200 OK
{
  "username":"[email protected]",
  "info":"Hello World!"
}

Update Profile

Request:

PUT /profile

{	
	"username":"[email protected]", 
	"new_info":"Father, Software Engineer", 
	"session":"5b30b1a4-31db-46e4-b359-9e726ccb681b"
}

Response:

Status: 200 OK
{}

Change Password

This requires either a session or the current password of the user

PUT /password

{	
	"username":"[email protected]", 
	"new_password":"test1", "new_password_confirm": "test1",
	"session":"5b30b1a4-31db-46e4-b359-9e726ccb681b"
}

Response:

Status: 200 OK
{}

Delete Profile

Request:

DELETE /profile

{	
	"username":"[email protected]", 
	"password":"test", 
	"session":"5b30b1a4-31db-46e4-b359-9e726ccb681b"
}

Response:

Status: 200 OK
{}