Track recently active and signin times (#663)

* Track recently active and signin times

* Trust proxy headers in production
This commit is contained in:
Tom Moor
2018-06-04 19:07:56 -07:00
committed by GitHub
parent 1977278426
commit 53a0f423c3
6 changed files with 62 additions and 0 deletions

View File

@ -79,6 +79,9 @@ export default function auth(options?: { required?: boolean } = {}) {
throw new UserSuspendedError({ adminEmail: suspendingAdmin.email });
}
// not awaiting the promise here so that the request is not blocked
user.updateActiveAt(ctx.request.ip);
ctx.state.token = token;
ctx.state.user = user;
// $FlowFixMe