Hello
I use the security option "Use Existing Table", this works fine, so I can setup the securtity level for each user. All User are in the table available.
Now I whant to have a single sign on for the user, because they are already registered on my Synology NAS, where also the web application runs.
The User have alread a registration on the synology and can also change and set the password there.
On Wordpress I use a PlugIn IMAP Authentication, because the NAS does have a mail server and an mail account for each user.
So I used the example code from the code repository under "Code -> Server Events -> Other -> Login Page"
// User Logging In event
function User_LoggingIn($usr, &$pwd) {
if (!function_exists("imap_open")) die("PHP IMAP extension not installed.");
// IMAP authentication example for User_CustomValidate server event
$mailboxStream = imap_open("{127.0.0.1:993/imap/ssl/novalidate-cert}",$usr,$pwd,0,1);
if ($mailboxStream) {
imap_close($mailboxStream);
$this->setCurrentUserName($usr); // Set the current user name
return TRUE;
}
}
But this login does not work as an authentication replacement, it is additional to the PHP Maker Table Authentication.
If I use the password from the Table, I receive the message:
Login cancelled
If I use the password from the IMAP Server, I receive the message:
Fatal error: Call to undefined method clogin::setCurrentUserName() in /volume1/web/access/login.php on line 454
I have also tested to use this code to set the user:
// User Logging In event
function User_LoggingIn($usr, &$pwd) {
if (!function_exists("imap_open")) die("PHP IMAP extension not installed.");
// IMAP authentication example for User_CustomValidate server event
$mailboxStream = imap_open("{127.0.0.1:993/imap/ssl/novalidate-cert}",$usr,$pwd,0,1);
if ($mailboxStream) {
imap_close($mailboxStream);
//$this->setCurrentUserName($usr); // Set the current user name
$_SESSION[EW_SESSION_USER_NAME] = $usr;
return TRUE;
}
}
Then if I login with the password of the IMAP Server, I get:
Incorrect user ID or password