Skip to content

Commit

Permalink
fix(auth): username not required
Browse files Browse the repository at this point in the history
  • Loading branch information
HagerDakroury committed Jul 14, 2021
1 parent eda8d02 commit 5063db0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion auth/src/models/connection.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import mongoose from "mongoose";

const uri = "mongodb://auth-db-service:27017/auth-test";
const uri =
"mongodb+srv://hager:[email protected]/contactsapp?retryWrites=true&w=majority";

const connectDb = () => mongoose.connect(uri);

Expand Down
4 changes: 2 additions & 2 deletions auth/src/routes/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { baseUrl } from "../config";
const router = express.Router();

router.post(`${baseUrl}/login`, async (req, res) => {
const { username, email, password } = req.body;
const { email, password } = req.body;

try {
const user = await User.findOne({ email });
Expand All @@ -19,7 +19,7 @@ router.post(`${baseUrl}/login`, async (req, res) => {
if (!passValid) {
return res.status(400).send("Password is not correct");
}
const { role } = user;
const { role, username } = user;

const userJWT = createAccessToken({ username, email, role });

Expand Down

0 comments on commit 5063db0

Please sign in to comment.