This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
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.
bandolier-template/api/login.js

36 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;