added logic to user.js