function logInMember() disappeared on 5.98 AppGini version

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
A Bindi
Veteran Member
Posts: 51
Joined: 2018-01-04 18:45

function logInMember() disappeared on 5.98 AppGini version

Post by A Bindi » 2021-11-18 13:55

Hello,

I have been using for some years with success the LDAP authentication applying the trick as explained in thread viewtopic.php?f=4&t=2707&p=10215&hilit=LDAP#p10215: the procedure involves replacing the function "logInMember()" in incCommon.php with the new function:

--------------------------------------------------------
function logInMember(){
$redir = 'index.php';

if($_POST['signIn'] != ''){
if($_POST['username'] != '' && $_POST['password'] != ''){

$username = makeSafe(strtolower($_POST['username']));
$password = md5($_POST['password']);
$ldap_username = 'mydomain\\'.$_POST['username']; //FDC\ is needed for the FDC ad depends on your ad setup
$ldap_password = $_POST['password'];
$link = ldap_connect('dc2.mydomain'); // Your domain or domain server

if ($link){ // The bind to domain was sucessfull
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3); // Recommended for AD

if (ldap_bind($link, $ldap_username, $ldap_password)) { // Now try to authenticate with credentials provided by user
$ldap_authorized = true;
$_POST['rememberMe']=0; // do not want to keep ad info in cookies
}
}

if ($ldap_authorized) { //if ldap_authorized carry on to see if registered in the program

//if(sqlValue("select count(1) from membership_users where lcase(memberID)='$username' and passMD5='$password' and isApproved=1 and isBanned=0")==1){

if(sqlValue("select count(1) from membership_users where lcase(memberID)='$username' and isApproved=1 and isBanned=0")==1){
$_SESSION['memberID']=$username;
$_SESSION['memberGroupID']=sqlValue("select groupID from membership_users where lcase(memberID)='$username'");

if($_POST['rememberMe']==1){
@setcookie('helpdesk_rememberMe', md5($username.$password), time()+86400*30);
}else{
@setcookie('helpdesk_rememberMe', '', time()-86400*30);
}

// hook: login_ok
if(function_exists('login_ok')){
$args=array();

if(!$redir=login_ok(getMemberInfo(), $args)){
$redir='index.php';
}
}

redirect($redir);
exit;
}
} //authorized ldap
}

// hook: login_failed
if(function_exists('login_failed')){
$args=array();
login_failed(array(
'username' => $_POST['username'],
'password' => $_POST['password'],
'IP' => $_SERVER['REMOTE_ADDR']
), $args);
}

if(!headers_sent()) header('HTTP/1.0 403 Forbidden');
redirect("index.php?loginFailed=1");
exit;
}elseif((!$_SESSION['memberID'] || $_SESSION['memberID']==$adminConfig['anonymousMember']) && $_COOKIE['helpdesk_rememberMe']!=''){
$chk=makeSafe($_COOKIE['helpdesk_rememberMe']);

if($username=sqlValue("select memberID from membership_users where convert(md5(concat(memberID, passMD5)), char)='$chk' and isBanned=0")){
$_SESSION['memberID']=$username;
$_SESSION['memberGroupID']=sqlValue("select groupID from membership_users where lcase(memberID)='$username'");
}
}
}

--------------------------------------------------------

Unfortunately after upgrading AppGini to new 5.98 (rev.1216) it seems that the logInMember() function is disappeared, so I cant't use LDAP anymore.

For now I reverted to Ver. 5.97, but I'd like to return to use LDAP also in the new versions, some ideas ?

ALex.

A Bindi
Veteran Member
Posts: 51
Joined: 2018-01-04 18:45

Re: function logInMember() disappeared on 5.98 AppGini version

Post by A Bindi » 2021-11-22 17:07

Does not really exists a method to integrate LDAP authentication in new AppGini version ?

ALex.

A Bindi
Veteran Member
Posts: 51
Joined: 2018-01-04 18:45

Re: function logInMember() disappeared on 5.98 AppGini version

Post by A Bindi » 2021-11-23 11:50

I will revert to 5.97, is the only way to continue the development with the LDAP auth active.

Thanks for all (no)hints.

ALex.

dlee
Veteran Member
Posts: 137
Joined: 2020-04-14 00:21
Location: South Carolina, USA
Contact:

Re: function logInMember() disappeared on 5.98 AppGini version

Post by dlee » 2021-11-24 19:48

How does one revert to a previous version of Appgini?

TD

A Bindi
Veteran Member
Posts: 51
Joined: 2018-01-04 18:45

Re: function logInMember() disappeared on 5.98 AppGini version

Post by A Bindi » 2021-11-24 20:07

dlee wrote:
2021-11-24 19:48
How does one revert to a previous version of Appgini?

TD
Re-installing old version using old installer.

ALex

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: function logInMember() disappeared on 5.98 AppGini version

Post by angus » 2022-02-17 23:05

Alex, did you get anywhere with the replacement for the logInMember()?

I also use this and it will stop me from upgrading to be honest
AppGini 22.13

A Bindi
Veteran Member
Posts: 51
Joined: 2018-01-04 18:45

Re: function logInMember() disappeared on 5.98 AppGini version

Post by A Bindi » 2022-09-07 09:14

angus wrote:
2022-02-17 23:05
Alex, did you get anywhere with the replacement for the logInMember()?

I also use this and it will stop me from upgrading to be honest
No, I'm stuck.

ALex.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: function logInMember() disappeared on 5.98 AppGini version

Post by a.gneady » 2024-01-23 17:36

I'm glad to announce that we've just added LDAP support to AppGini 24.10, https://bigprof.com/appgini/help/ldap-authentication

All you need to do is configure LDAP settings from the admin area > Utilities menu > Admin settings > LDAP

You don't need to define your LDAP users first in your AppGini app. Instead, you can configure LDAP settings to automatically add new users to a specified group. May be you could give this group minimal or no permissions, review the users in there, and move them to other groups to activate them.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply