Skip to content

Commit

Permalink
Merge pull request #83 from neverovski/feature/forgot-password
Browse files Browse the repository at this point in the history
Feature/forgot password
  • Loading branch information
neverovski authored Jan 7, 2024
2 parents a786850 + 539b268 commit e4013fc
Show file tree
Hide file tree
Showing 87 changed files with 1,095 additions and 451 deletions.
51 changes: 31 additions & 20 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
# APP
NODE_ENV=development
APP_HOST=http://127.0.0.1
APP_NAME=AUTH-SERVER
APP_PORT=5858
APP_HOST=http://127.0.0.1
APP_ENV=development

# JWT
JWT_SECRET_TOKEN=
JWT_EXPIRES_IN_ACCESS_TOKEN=15m
JWT_EXPIRES_IN_REFRESH_TOKEN=30d
JWT_EXPIRES_IN_TOKEN=1d
JWT_SECRET_ACCESS_TOKEN=
JWT_EXPIRES_IN_ACCESS_TOKEN=15m
JWT_SECRET_REFRESH_TOKEN=
JWT_EXPIRES_IN_REFRESH_TOKEN=30d
JWT_SECRET_TOKEN=

# LOGGER
LOG_API_KEY=
LOG_CLIENT=console
LOG_ENABLED=false
LOG_URL=
LOG_ENABLED=true
LOG_SSL_CA_BASE64=
LOG_URL=

# DATABASE
DB_CACHE_ENABLED=false
DB_CACHE_TIME=5000
DB_CHARSET=utf8
DB_CLIENT=postgres
DB_HOST=127.0.0.1
DB_PORT=54323
DB_USER=
DB_PASSWORD=
DB_LOG_ENABLED=true
DB_NAME=
DB_CHARSET=utf8
DB_DEBUG=true
DB_CACHE_TIME=5000
DB_SSL_ENABLED=false
DB_PASSWORD=
DB_PORT=54323
DB_SSL_CA_BASE64=
DB_SSL_ENABLED=false
DB_USER=

# REDIS
REDIS_CLUSTER_MODE_ENABLED=false
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=
REDIS_PORT=6969
REDIS_QUEUE_PREFIX=AUTH
REDIS_PASSWORD=
REDIS_USERNAME=
REDIS_TLS=false
REDIS_USERNAME=

# EMAIL SERVICE
MAIL_DRIVER=smtp
MAIL_ENCRYPTION=ssl
MAIL_HOST=
MAIL_PORT=465
MAIL_NAME=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=ssl
MAIL_PORT=465
MAIL_USERNAME=

# FACEBOOK
FACEBOOK_URL=https://graph.facebook.com/me
FACEBOOK_FIELDS=id,first_name,last_name,email
FACEBOOK_URL=https://graph.facebook.com/me

# APPLE
APPLE_URL=https://appleid.apple.com/auth/keys
Expand All @@ -61,3 +63,12 @@ GOOGLE_URL=https://www.googleapis.com/oauth2/v3/userinfo

# GITHUB
GITHUB_URL=https://api.github.com/user

# REST CLIENT VSCODE [USER]
REST_APPLE_TOKEN=
REST_FACEBOOK_TOKEN=
REST_GITHUB_TOKEN=
REST_GOOGLE_TOKEN=
REST_USER_ACCESS_TOKEN=
REST_USER_LOGIN=dmitryneverovski@gmail.com
REST_USER_PASSWORD=12345678
46 changes: 24 additions & 22 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
# APP
NODE_ENV=test
APP_HOST=http://127.0.0.1
APP_NAME=AUTH-SERVER
APP_PORT=5858
APP_HOST=APP_HOST
APP_ENV=test

# JWT
JWT_SECRET_TOKEN=JWT_SECRET_TOKEN
JWT_EXPIRES_IN_ACCESS_TOKEN=15m
JWT_EXPIRES_IN_REFRESH_TOKEN=30d
JWT_EXPIRES_IN_TOKEN=1d
JWT_SECRET_ACCESS_TOKEN=JWT_SECRET_ACCESS_TOKEN
JWT_EXPIRES_IN_ACCESS_TOKEN=15m
JWT_SECRET_REFRESH_TOKEN=JWT_SECRET_REFRESH_TOKEN
JWT_EXPIRES_IN_REFRESH_TOKEN=30d
JWT_SECRET_TOKEN=JWT_SECRET_TOKEN

# LOGGER
LOG_API_KEY=
LOG_CLIENT=console
LOG_ENABLED=false
LOG_URL=
LOG_SSL_CA_BASE64=
LOG_URL=

# DATABASE
DB_CACHE_ENABLED=false
DB_CACHE_TIME=5000
DB_CHARSET=utf8
DB_CLIENT=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USER=DB_USER
DB_PASSWORD=DB_PASSWORD
DB_LOG_ENABLED=false
DB_NAME=DB_NAME
DB_CHARSET=utf8
DB_DEBUG=false
DB_CACHE_TIME=5000
DB_SSL_ENABLED=false
DB_PASSWORD=DB_PASSWORD
DB_PORT=54323
DB_SSL_CA_BASE64=
DB_SSL_ENABLED=false
DB_USER=

# REDIS
REDIS_CLUSTER_MODE_ENABLED=false
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_PORT=6969
REDIS_QUEUE_PREFIX=AUTH
REDIS_PASSWORD=REDIS_PASSWORD
REDIS_USERNAME=REDIS_USERNAME
REDIS_TLS=false
REDIS_USERNAME=

# EMAIL SERVICE
MAIL_DRIVER=smtp
MAIL_HOST=MAIL_HOST
MAIL_PORT=465
MAIL_NAME=MAIL_NAME
MAIL_USERNAME=MAIL_USERNAME
MAIL_PASSWORD=MAIL_PASSWORD
MAIL_ENCRYPTION=ssl
MAIL_HOST=
MAIL_NAME=
MAIL_PASSWORD=
MAIL_PORT=465
MAIL_USERNAME=

# FACEBOOK
FACEBOOK_URL=https://graph.facebook.com/me
FACEBOOK_FIELDS=id,first_name,last_name,email
FACEBOOK_URL=https://graph.facebook.com/me

# APPLE
APPLE_URL=https://appleid.apple.com/auth/keys
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"rest-client.environmentVariables": {
"local": {
"host": "http://127.0.0.1:5858"
"host": "http://127.0.0.1:5858",
"apiUrl": "http://127.0.0.1:5858/api",
}
},
"rest-client.defaultHeaders": {
Expand Down
80 changes: 43 additions & 37 deletions http/auth.http
Original file line number Diff line number Diff line change
@@ -1,66 +1,72 @@
### LOGS USER INTO THE SYSTEM BY EMAIL AND PASSWORD
POST {{host}}/api/auth/login
Content-Type: application/json
### LOGIN [USER]
# @name loginUser
POST {{apiUrl}}/auth/login

{
"email": "test@test.com1",
"password": "12345678"
"email": "{{$dotenv REST_USER_LOGIN}}",
"password": "{{$dotenv REST_USER_PASSWORD}}"
}

### LOGOUT [USER]
POST {{apiUrl}}/auth/logout
Authorization: Bearer {{loginUser.response.body.data.accessToken}}

### LOGS OUT CURRENT LOGGED-IN USER SESSION
POST {{host}}/api/auth/logout
Authorization: Bearer {{accessToken}}
Content-Type: application/json
### LOGOUT [USER]
POST {{apiUrl}}/auth/logout
Cookie: accessToken={{loginUser.response.body.data.accessToken}}

### FORGOT PASSWORD
POST {{host}}/api/auth/forgot-password
Content-Type: application/json
### REFRESH-TOKEN [USER]
POST {{apiUrl}}/auth/refresh-token

{
"email": "{{email}}"
"refreshToken": "{{loginUser.response.body.data.refreshToken}}"
}

### RESET PASSWORD
POST {{host}}/api/auth/reset-password
Content-Type: application/json

{
"token": "{{passwordToken}}",
"password": "{{newPassword}}"
}

### REFRESH TOKEN
POST {{host}}/api/auth/refresh-token
Content-Type: application/json
### LOGS USER INTO THE SYSTEM THROUGH A APPLE
POST {{apiUrl}}/auth/platform

{
"refreshToken": "{{refreshToken}}"
"token": "{{$dotenv REST_APPLE_TOKEN}}",
"platform": "apple"
}

### LOGS USER INTO THE SYSTEM THROUGH A FACEBOOK
POST {{host}}/api/auth/platform
Content-Type: application/json
POST {{apiUrl}}/auth/platform

{
"token": "{{facebookToken}}",
"token": "{{$dotenv REST_FACEBOOK_TOKEN}}",
"platform": "facebook"
}

### LOGS USER INTO THE SYSTEM THROUGH A APPLE
POST {{host}}/api/auth/platform
Content-Type: application/json

### LOGS USER INTO THE SYSTEM THROUGH A GOOGLE
POST {{apiUrl}}/auth/platform

{
"token": "{{appleToken}}",
"platform": "apple"
"token": "{{$dotenv REST_GOOGLE_TOKEN}}",
"platform": "github"
}

### LOGS USER INTO THE SYSTEM THROUGH A GITHUB
POST {{host}}/api/auth/platform
Content-Type: application/json
POST {{apiUrl}}/auth/platform

{
"token": "{{githubToken}}",
"token": "{{$dotenv REST_GITHUB_TOKEN}}",
"platform": "github"
}

### FORGOT PASSWORD BY EMAIL
POST {{apiUrl}}/auth/password/email

{
"email": "{{$dotenv REST_USER_LOGIN}}"
}

### RESET PASSWORD BY EMAIL
POST {{apiUrl}}/auth/password/reset/email

{
"email": "{{$dotenv REST_USER_LOGIN}}",
"token": "b70e0419-9839-4a6e-a799-8580e929e5a9",
"password": "{{$dotenv REST_USER_PASSWORD}}"
}
1 change: 0 additions & 1 deletion http/config/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions http/config/http-client.env.json

This file was deleted.

24 changes: 0 additions & 24 deletions http/config/http-client.private.env.example.json

This file was deleted.

48 changes: 22 additions & 26 deletions http/user.http
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
### RETURN A CURRENT USER
GET {{host}}/api/users/current
Content-Type: application/json
### RETURN A CURRENT USER [USER]
GET {{apiUrl}}/users/current
Authorization: Bearer {{dotenv REST_USER_ACCESS_TOKEN}}

### UPDATE A CURRENT USER
PUT {{host}}/api/users/current
Authorization: Bearer {{accessToken}}
Content-Type: application/json
### CREATE A USER [USER]
POST {{apiUrl}}/users

{
"email": "{{$dotenv REST_USER_LOGIN}}",
"password": "{{$dotenv REST_USER_PASSWORD}}",
"profile": {
"firstName": "Dmitry",
"lastName": "Neverovski"
"firstName": "D.",
"lastName": "N."
}
}

### CREATE A USER
POST {{host}}/api/users
Content-Type: application/json
### UPDATE A CURRENT USER [USER]
PUT {{apiUrl}}/users/current
Authorization: Bearer {{dotenv REST_USER_ACCESS_TOKEN}}

{
"email": "{{email}}",
"password": "{{password}}",
"profile": {
"firstName": "D.",
"lastName": "N."
"firstName": "Dmitry",
"lastName": "Neverovski"
}
}

### CHANGE PASSWORD FOR A CURRENT USER
POST {{host}}/api/users/current/change-password
Authorization: Bearer {{accessToken}}
Content-Type: application/json
### CHANGE PASSWORD FOR A CURRENT USER [USER]
POST {{apiUrl}}/users/current/change-password
Authorization: Bearer {{dotenv REST_USER_ACCESS_TOKEN}}

{
"oldPassword": "{{password}}",
"newPassword": "{{newPassword}}"
"oldPassword": "{{$dotenv REST_USER_PASSWORD}}",
"newPassword": "87654321"
}

### DELETE A CURRENT USER
DELETE {{host}}/api/users/current
Authorization: Bearer {{accessToken}}
Content-Type: application/json
### DELETE A CURRENT USER [USER]
DELETE {{apiUrl}}/users/current
Authorization: Bearer {{dotenv REST_USER_ACCESS_TOKEN}}
Loading

0 comments on commit e4013fc

Please sign in to comment.