Skip to content

Conversation

@duynguyenod
Copy link

Implementations
  • Add authentication services
  • Modify User model
  • Add methods and static methods to user model
  • Add unit tests for user model
  • Add unit tests for service

@duynguyenod duynguyenod added the enhancement New feature or request label Nov 29, 2019
@duynguyenod duynguyenod self-assigned this Nov 29, 2019
// Generate an auth token for the user
const user = this;
// eslint-disable-next-line no-underscore-dangle
const token = jwt.sign({ _id: user._id }, process.env.JWT_KEY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phần này anh không cần cho thêm hạn sử dụng của token à anh?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do dự án mình login chỉ để lấy thông tin, email người dùng thôi. Và anh muốn người ta không cần phải đăng nhập nhiều. Nên mình không cần expire.

const UserSchema = new Schema(
const UserSchema = Schema(
{
email: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email thiếu unique ạ

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ủa có rồi mà e :D

@duynguyenod duynguyenod merged commit 8beee7d into integration Dec 2, 2019
@duynguyenod duynguyenod deleted the feature/ODE-50-create-authentication-service branch December 2, 2019 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants