This is a parody of leetcode.com for designers. It's being developed live on Twitch.tv/zedashaw to demonstrate how to make a parody of a website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
pixelperfectionist/api/login.js

35 lines
1.0 KiB

export const get = (req, res) => {
// NOTE: we could also set authenticated in models.User.auth but this is more of a
// UI level variable than an authentication variable. If the code gets to this
// point then the get.authenticated passed and the user has to be authenticated.
const reply = {
id: req.user.id,
initials: req.user.initials,
full_name: req.user.full_name,
admin: req.user.admin,
email: req.user.email,
discord_sent: req.user.discord_sent,
unsubscribe: req.user.unsubscribe,
authenticated: true
}
res.status(200).json(reply);
}
get.authenticated = true;
export const post = (req, res) => {
const reply = {
id: req.user.id,
initials: req.user.initials,
full_name: req.user.full_name,
admin: req.user.admin,
email: req.user.email,
unsubscribe: req.user.unsubscribe,
discord_sent: req.user.discord_sent,
authenticated: true
}
res.status(200).json(reply);
}
// this flags it as a login endpoint expecting a username/password
post.login = true;