paytm's People
Forkers
shreyasprabhu26 pranavkumar20 subhash14303 bharathkumar01-k fullstackcoder2308 ekanshka midhun-r dravinbhatia sainiaditya1 ash9311 rahulcs754 md-arin vignesh7h krunaldarekar sahildahekar somnath-sanu san-jay-14 neerajdhakad asr1802 siva9495 ttahm3d kedarshenoy karananeja k7-n yervapavan pravarjain19 chetan7045 cloudashu arjun0023 hemaljoshi rejisterjack akshat09022002 iamgauravbisht y2worry yh010 sillydotdev shashwa7-dev nihar-hegde eulerbutcooler devharry066 its-id devsathwara naman933 razeen2004 piyushxmishra vaibhavtalkhande sarrveshhh rahulagg7 diya3030 harshashetty67 rajan0402 auro-jyoti pankaj-2503 mattiullah134 ajaydeep123 vignesh-murugan-dev vibhaw1904 abhishek-1337 santhoshpemmaka mrthakur30 arvindkhoisnam ameerjafar varunmokra pradyumnasavadatti yaswant-kowtha shahzad285 deepak7mehra sharain7 aayushk9 aswin246 rvaindra7330 rambhaktrohit paulpriyanshu akash12233 nyxdeity perplexedfor siddarthapogula droovian the-mainak-banerjee yeshwantthota shravankshenoy manju121212 starlord21 rakshitnayak va1bhav-gupta rudra-iitm prasanth-s7 bkm14 sankalp-sa piyush-3110 chahbaz-aman pvcodes karaskaki fluttery-dev sathyam1020 bansal1999 pchawlaji krishnagptamcs aknair19 rimaru06paytm's Issues
what is correct code for signin page
in signin page code onclick code is not provided
whomsoever is login , that name should not be visible in filter data users, or all the users
for eg:
If Harkirat is logged in, then he should not see his name coming in the dashboard, it will be stupid if that person is sending money to himself only,
How to tackle this while getting all the users except the user who is logged in?
balance is not getting updated after a transfer
Code for updating the user information is wrong
In backend->routes->user
await User.updateOne(req.body, {
id: req.userId
})
res.json({
message: "Updated successfully"
})
updateOne
takes filter as the first argument and updated information as the second argument, but opposite is been done here.
Password hashing and salting is pending !
Whenever we are creating new user, the user's password should be hased before saving to the database
Balance not showing in the get request in account/balance
the error im getting is :SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at createStrictSyntaxError (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\types\json.js:160:10)
at parse (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\types\json.js:83:15)
at C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\body-parser\lib\read.js:128:18
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at invokeCallback (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:231:16)
at done (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:220:7)
at IncomingMessage.onEnd (C:\Users\nares\OneDrive\Desktop\Paytm\paytm\backend\node_modules\raw-body\index.js:280:7)
at IncomingMessage.emit (node:events:514:28)
at endReadableNT (node:internal/streams/readable:1359:12)
My code:const express=require("express");
const router=express.Router();
const zod=require("zod");
const {user}=require("../db");
const jwt=require("jsonwebtoken");
const {JWT_SEC}=require("../config");
const {authMiddleware}=require("../middleware")
const signupSchema=zod.object({
username:zod.string().email(),
password:zod.string(),
firstname:zod.string(),
lastname:zod.string(),
});
router.post("/signup",async(req,res)=>{
const body=req.body;
const {success}=signupSchema.safeParse(req.body);
if(!success){
return res.status(400).json({
message:" incorrect inputs"
})
}
const existingUser= await user.findOne({
username:body.username
})
if(existingUser){
return res.status(409).json({
message:"Email already taken"
})
}
const dbUser=await user.create({
username:body.username,
password:body.password,
firstname:body.firstname,
lastname:body.lastname,
});
const token=jwt.sign({
userId:dbUser._id
},JWT_SEC)
res.status(201).json({
message:"User created successfully",
token:token
})
});
const signinBody = zod.object({
username: zod.string().email(),
password: zod.string()
})
router.post("/signin",async(req,res)=>{
const body=req.body;
const {success}=signinBody.safeParse(body);
if(!success){
return res.status(400).json({
message:" incorrect inputs"
})
}
const userRecord = await user.findOne({
username: req.body.username,
password: req.body.password
});
if (userRecord) {
const token = jwt.sign({
userId: userRecord._id
}, JWT_SEC);
res.json({
token: token
})
return;
}
res.status(401).json({
message: "Error while logging in"
})
})
const updateBody = zod.object({
password: zod.string().optional(),
firstName: zod.string().optional(),
lastName: zod.string().optional(),
})
router.put("/", authMiddleware, async (req, res) => {
const { success } = updateBody.safeParse(req.body)
if (!success) {
res.status(400).json({
message: "Error while updating information"
})
}
await user.updateOne(req.body, {
id: req.userId
})
res.json({
message: "Updated successfully"
})
})
router.get("/bulk", async (req, res) => {
const filter = req.query.filter || "";
const users = await user.find({
$or: [{
firstName: {
"$regex": filter
}
}, {
lastName: {
"$regex": filter
}
}]
})
res.json({
user: users.map(user => ({
username: user.username,
firstName: user.firstname,
lastName: user.lastname,
_id: user._id
}))
})
})
module.exports=router;
how to actually send the request from frontend to backend if i am hosting this project
what is correct code for signin page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.