Coder Social home page Coder Social logo

training-auth's Introduction

CollabCode

CollabCode Training

An Open Source online course platform.

Getting Started

  1. Fork this repo and clone in your machine;

  2. Change directory to collabcodetraining-api-auth where you cloned it;

  3. At the terminal, run:

npm install
cp example.env .env
npm run dev
  1. Open up localhost:5000 and start using it

Prerequisites

  • Npm
  • Node (>=10.16.3)

Running the tests

npm test

Running MongoDB with docker

Prerequisites

  • Docker (>=1.13.1)

Run the following command on the project root directory:

docker-compose up -d

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MPL 2.0 License - see the LICENSE file for details

Acknowledgments

Thanks to all members of CollabCode's community for the support! We love you!

training-auth's People

Contributors

dependabot[bot] avatar dronept avatar jailsonsf avatar joviane avatar marcobrunodev avatar masterl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

training-auth's Issues

Refresh token

Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
Route to refresh token

Describe alternatives you've considered
No

Additional context
No

CORS

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Configuration CORS

Additional context
No

Builder test

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Create builder test

Describe alternatives you've considered
No

Additional context
No

Route login

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Create route /api/login

Describe alternatives you've considered
No

Additional context
No

Docker MongoDB

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
NO

Describe alternatives you've considered
Add the docker with mongodb

Additional context
No

User password getting hashed more than once on pre save hook

Describe the bug
User password is getting hashed every time the model is saved, because of pre save hook.
Hashing the hashed password can result in a lost account.

It's happening because there are no checks on User.pre("save") hook, even though there is only one route that triggers this operation at the moment, it's probable that there'll be more in the future.

To Reproduce
Steps to reproduce the behavior:

  1. Copy paste the code
  2. Make sure you have bcryptjs installed
const bcrypt = require("bcryptjs");

async function main() {
  const password = "hello world!";

  const hashed_once = await bcrypt.hash(password, 10);
  const hashed_twice = await bcrypt.hash(hashed_once, 10);

  const equal_hashed_once = await bcrypt.compare(password, hashed_once);
  console.log("equal_hashed_once =>", equal_hashed_once); // true

  const equal_hashed_twice = await bcrypt.compare(password, hashed_twice);
  console.log("equal_hashed_twice =>", equal_hashed_twice); // false
}
main();

Expected behavior
User password should be hashed only once when it has been modified.

Restify Errro

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Add the lib restify-error

Additional context
NO

Cryptographically signed cookie

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Add cryptographically signed cookie in key jwt

Describe alternatives you've considered
No
Additional context
No

Mochawesome

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Configuration mochawesome

Describe alternatives you've considered
No

Additional context
No

Remove log request mocha

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Remove the log's request in mocha

Describe alternatives you've considered
No

Additional context
No

Message success login

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Add message success for login

Describe alternatives you've considered
No

Additional context
No

Frameworks for TDD

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Install frameworks for TDD:

  • supertest;
  • mock;
  • chai.

Additional context
No

Validation save user

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Create validations:

  • Verify fields, name; email and password;
  • Registered email;
  • Valid email;
  • Password with 8 chars.

Describe alternatives you've considered
No

Additional context
No

Error login

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Return field name error in login route

Describe alternatives you've considered
No

Additional context
No

Route forgot

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
Create a route to forgot where the frontend with react will send an email and our API will use the email API to send an email with a link to the user reset a new password.

Describe alternatives you've considered
Maybe generate a token with an expiration date.

Additional context
No.

Send JWT cookie

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Send JWT Cookie

Describe alternatives you've considered
No

Additional context
No

Add restify-cors-middleware

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Add the lib restify-cors-middleware

Additional context
No

Test README.md

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Add test in README.md

Describe alternatives you've considered
No

Additional context
No

Connection MongoDB

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Create connection as the MongoDB

Additional context
No

Route Signup

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
No

Describe alternatives you've considered
Create route signup with the fields:
Name;
Email;
Password.

Additional context
No

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.