Skip to content

Commit

Permalink
fix and rebuild worker
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcoll committed Feb 26, 2023
1 parent 0be5f55 commit 59fb5bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion public/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function fromServer(request) {
if (response.status === 307) {
response.clone().json().then((response) => {
if( typeof response.hash!=="undefined" ) {
const reader = (clonedRequest && typeof clonedRequest.body!==null)?clonedRequest.body.getReader():null;
const reader = (clonedRequest && clonedRequest.body!==null)?clonedRequest.body.getReader():null;
if( reader ) {
reader.read().then(({ done, value }) => {
self.originalBody = JSON.stringify( JSON.parse( self.Utf8ArrayToStr(value) ));
Expand Down
5 changes: 3 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ const challengeOTP = (res, req, rp, defaultUser) => new Promise((resolve, reject
// Threashold on Brute Force attempt - based on session
(bruteForceCount>otpBruteForceCount), // this is async and not available // TODO

// Do not create OTP challenge if the user already have one in the past 5 min
(req.user.lastOTP!==null && moment(parseInt(req.user.lastOTP, 10)).isBefore(moment().subtract(5, "minutes"))), // TODO
// Do not create OTP challenge if the user already have one in the past 5 days
(req.user.lastOTP!==null && moment(parseInt(req.user.lastOTP, 10)).isBefore(moment().subtract(5, "days"))), // TODO
// or when user never had an OTP
(typeof req.user.lastOTP==="undefined" || req.user.lastOTP===null),

Expand Down Expand Up @@ -115,6 +115,7 @@ const challengeOTP = (res, req, rp, defaultUser) => new Promise((resolve, reject
user.currentDevice = currentDevice;
t6console.debug("OTP challenge lastOTP is updated");
let otp = t6mailer.generateOTP(user, res);
req.user = user;
otp.then((otp) => {
t6events.addAudit("t6App", "OTP challenge emailed", user.id, user.id, {"status": 307, "error_id": 1029});
t6events.addStat("t6App", "OTP challenge emailed", user.id, user.id, {"status": 307, "error_id": 1029});
Expand Down
2 changes: 1 addition & 1 deletion t6BuildVersion.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"t6BuildVersion": "7e8a73ced3cef0876dc156f057014458", "t6BuildDate": "Sun, 26 Feb 2023 10:11:49 +0100"}
{"t6BuildVersion": "7e8a73ced3cef0876dc156f057014458", "t6BuildDate": "Sun, 26 Feb 2023 13:18:23 +0100"}

0 comments on commit 59fb5bd

Please sign in to comment.