Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

121: Adding ability to track Login.gov logins on admin page #166

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
2 changes: 1 addition & 1 deletion server/routes/admin.report.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module.exports = {
userLogin : async function (req, res) {
logger.log("debug", "Running user login report")
let userLogins = {}
let sql = `select timestamp, message, meta#>>'{cas_userinfo, email-address}' as email from winston_logs where message like '%authenticated with MAX CAS ID%'`
let sql = `select timestamp, message, COALESCE(meta#>>'{cas_userinfo, user, email}', meta#>>'{cas_userinfo, email-address}') as email from winston_logs where message like '%authenticated with%'`
let rows = await db.sequelize.query(sql, { type: db.sequelize.QueryTypes.SELECT })

for (let r of rows) {
Expand Down
2 changes: 1 addition & 1 deletion server/routes/auth.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ module.exports = {
srt_userinfo.user = stored_user.dataValues
srt_userinfo.user.sessionEnd = Math.floor ((new Date().getTime() + ms(getConfig('sessionLength')) )/ 1000)


logger.log('info', (srt_userinfo.email || userInfo.email) + ' authenticated with LOGIN.GOV', {cas_userinfo: srt_userinfo, tag: 'Login.gov Auth Token'})

let uri_components = {
token: jwt.sign({access_token: accessToken, user: srt_userinfo.user, sessionEnd: srt_userinfo.sessionEnd, token_life_in_seconds: getConfig('renewTokenLife')}, common.jwtSecret, { expiresIn: getConfig('renewTokenLife') }),
Expand Down