Skip to content

Commit

Permalink
Merge pull request #197 from moeiscool/dev
Browse files Browse the repository at this point in the history
critical bug fix
  • Loading branch information
moeiscool authored Jun 16, 2017
2 parents 9b522bc + 87bd4ab commit cf6f24c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
22 changes: 14 additions & 8 deletions camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,14 @@ app.post('/',function (req,res){
r.details.acceptedMachines={}
}
if(!r.details.acceptedMachines[req.body.machineID]){
req.complete=function(){
s.factorAuth[r.ke][r.uid].info=req.resp;
clearTimeout(s.factorAuth[r.ke][r.uid].expireAuth)
s.factorAuth[r.ke][r.uid].expireAuth=setTimeout(function(){
s.deleteFactorAuth(r)
},1000*60*15)
res.render("factor",{$user:req.resp})
}
if(!s.factorAuth[r.ke]){s.factorAuth[r.ke]={}}
if(!s.factorAuth[r.ke][r.uid]){
s.factorAuth[r.ke][r.uid]={key:s.nid()}
Expand All @@ -2497,17 +2505,15 @@ app.post('/',function (req,res){
};
nodemailer.sendMail(r.mailOptions, (error, info) => {
if (error) {
console.log(error)
return ;
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)
req.fn()
return
}
req.complete()
});
}else{
req.complete()
}
s.factorAuth[r.ke][r.uid].info=req.resp;
clearTimeout(s.factorAuth[r.ke][r.uid].expireAuth)
s.factorAuth[r.ke][r.uid].expireAuth=setTimeout(function(){
s.deleteFactorAuth(r)
},1000*60*15)
res.render("factor",{$user:req.resp})
}else{
req.fn()
}
Expand Down
10 changes: 5 additions & 5 deletions web/pages/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@
<% var failedLogin;if(failedLogin===true){ %>
localStorage.removeItem('ShinobiLogin_'+location.host)
<% } %>
$.ccio={f:$('#login-form'),ls:localStorage.getItem('ShinobiLogin_'+location.host),ls:localStorage.getItem('ShinobiAuth_'+location.host)}
$.ccio={f:$('#login-form'),ls:localStorage.getItem('ShinobiLogin_'+location.host),auth:localStorage.getItem('ShinobiAuth_'+location.host)}
$.ccio.gid=function(x){
if(!x){x=10};var t = "";var p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < x; i++ )
t += p.charAt(Math.floor(Math.random() * p.length));
return t;
};
if(!$.ccio.ls||$.ccio.ls===''){
$.ccio.ls=$.ccio.gid(20)
localStorage.setItem('ShinobiAuth_'+location.host,$.ccio.ls)
if(!$.ccio.auth||$.ccio.auth===''){
$.ccio.auth=$.ccio.gid(20)
localStorage.setItem('ShinobiAuth_'+location.host,$.ccio.auth)
}
$(document).ready(function(){
$('#machineID').val($.ccio.ls)
$('#machineID').val($.ccio.auth)
})
$.ccio.f.submit(function(e){
$('input').css('border-color','')
Expand Down

0 comments on commit cf6f24c

Please sign in to comment.