[CLOSED] New LDAP login has no webosocket connection on first login
-
Damian on Discord - Today at 9:39 AM
Hi. I probably found a bug in the ldap function. I works at all. But the first time a new ldap user is logging in, the dashboard is displayed without any cam. In the log I see the creation of the user in the DB. The second time the same user logs in, all cams are displayed.
The second time the "Websocket Connected" is logged, but the first time it is not logged.
-
Damian - Today at 8:46 AM
I think I have found at least a workaround (or maybe solution): In main.dash2.js, line 306 (case'filters') I found, that the first time user.details.filters is undefined and added an if statement:case'filters': k.tmp='<option value="" selected><%-cleanLang(lang['Add New'])%></option>'; if (user.details.filters){ $.each(user.details.filters,function(n,v){ k.tmp+='<option value="'+v.id+'">'+v.name+'</option>' }); $('#saved_filters').html(k.tmp) }
In the next case'id' the d.details is of type string so I added JSON.parse to it:
case'id': $('.usermail').html(d.mail) // converting to object if (typeof d.details == 'string'){ d.details = JSON.parse(d.details); } k.d=d.details; try{user.mon_groups=JSON.parse(k.d.mon_groups);}catch(er){} if(!user.mon_groups)user.mon_groups={}; $.sM.reDrawMonGroups() $.each(user,function(n,v){$.sM.e.find('[name="'+n+'"]').val(v).change()}) $.each(k.d,function(n,v){$.sM.e.find('[detail="'+n+'"]').val(v).change()}) $.gR.drawList(); $.ccio.pm('link-set',k.d.links,null,user)
And in camera.js line 3044 I have added the filters to the details object:
req.resp={ ke:req.body.key, uid:user.uid, auth:s.md5(s.gid()), mail:user.cn, pass:s.md5(req.body.pass), details:JSON.stringify({ sub:'1', ldap:'1', allmonitors:'1', filters:{} }) }
It helps to get rid of hanging dashboard issue on first login of an ldap user.
-
this was fixed by Damian
https://github.com/ShinobiCCTV/Shinobi/pull/21