Skip to content

Commit cf6f24c

Browse files
authored
Merge pull request #197 from moeiscool/dev
critical bug fix
2 parents 9b522bc + 87bd4ab commit cf6f24c

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

camera.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,6 +2486,14 @@ app.post('/',function (req,res){
24862486
r.details.acceptedMachines={}
24872487
}
24882488
if(!r.details.acceptedMachines[req.body.machineID]){
2489+
req.complete=function(){
2490+
s.factorAuth[r.ke][r.uid].info=req.resp;
2491+
clearTimeout(s.factorAuth[r.ke][r.uid].expireAuth)
2492+
s.factorAuth[r.ke][r.uid].expireAuth=setTimeout(function(){
2493+
s.deleteFactorAuth(r)
2494+
},1000*60*15)
2495+
res.render("factor",{$user:req.resp})
2496+
}
24892497
if(!s.factorAuth[r.ke]){s.factorAuth[r.ke]={}}
24902498
if(!s.factorAuth[r.ke][r.uid]){
24912499
s.factorAuth[r.ke][r.uid]={key:s.nid()}
@@ -2497,17 +2505,15 @@ app.post('/',function (req,res){
24972505
};
24982506
nodemailer.sendMail(r.mailOptions, (error, info) => {
24992507
if (error) {
2500-
console.log(error)
2501-
return ;
2508+
s.systemLog('MAIL ERROR : You must set up conf.json with the mail object or this feature will not work. skipping 2-Factor Authentication this time.',error)
2509+
req.fn()
2510+
return
25022511
}
2512+
req.complete()
25032513
});
2514+
}else{
2515+
req.complete()
25042516
}
2505-
s.factorAuth[r.ke][r.uid].info=req.resp;
2506-
clearTimeout(s.factorAuth[r.ke][r.uid].expireAuth)
2507-
s.factorAuth[r.ke][r.uid].expireAuth=setTimeout(function(){
2508-
s.deleteFactorAuth(r)
2509-
},1000*60*15)
2510-
res.render("factor",{$user:req.resp})
25112517
}else{
25122518
req.fn()
25132519
}

web/pages/index.ejs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@
6464
<% var failedLogin;if(failedLogin===true){ %>
6565
localStorage.removeItem('ShinobiLogin_'+location.host)
6666
<% } %>
67-
$.ccio={f:$('#login-form'),ls:localStorage.getItem('ShinobiLogin_'+location.host),ls:localStorage.getItem('ShinobiAuth_'+location.host)}
67+
$.ccio={f:$('#login-form'),ls:localStorage.getItem('ShinobiLogin_'+location.host),auth:localStorage.getItem('ShinobiAuth_'+location.host)}
6868
$.ccio.gid=function(x){
6969
if(!x){x=10};var t = "";var p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
7070
for( var i=0; i < x; i++ )
7171
t += p.charAt(Math.floor(Math.random() * p.length));
7272
return t;
7373
};
74-
if(!$.ccio.ls||$.ccio.ls===''){
75-
$.ccio.ls=$.ccio.gid(20)
76-
localStorage.setItem('ShinobiAuth_'+location.host,$.ccio.ls)
74+
if(!$.ccio.auth||$.ccio.auth===''){
75+
$.ccio.auth=$.ccio.gid(20)
76+
localStorage.setItem('ShinobiAuth_'+location.host,$.ccio.auth)
7777
}
7878
$(document).ready(function(){
79-
$('#machineID').val($.ccio.ls)
79+
$('#machineID').val($.ccio.auth)
8080
})
8181
$.ccio.f.submit(function(e){
8282
$('input').css('border-color','')

0 commit comments

Comments
 (0)