*/
/** User authentication (abstract class) */
class auth
{
/** The application name */
public $appName = null;
/** Display the authentication page
* The message is displayed to the user in case of error
* The url is the caller url to go back if authentication is correct
* @param string $baseURL The URL base to use for the links
* @param string|null $message Message to display to the user
* @param string|null $url URL to go back after successful authentication
* @param mixed $alreadyAuth If the user is already authenticated, the value
* will be displayed if the user is coming on the page.
*/
public function pageHTML ($baseURL, $message="", $url="", $alreadyAuth=false)
{
$res = "";
$res .= "\n";
$res .= "\n";
$res .= "
\n";
$res .= " \n";
$res .= "\n";
$res .= "\n";
$res .= "\n";
return $res;
}
/** Establish the connection to authentication server
*/
public function connect ()
{
throw new Exception (dgettext("domframework",
"No connect to authentication available"),
405);
}
/** Check if the email and password are correct
* Return TRUE if the authentication is correct
* Return an exception if there is a problem
* @param string $email Email to authenticate
* @param string $password Password to authenticate
*/
public function authentication ($email, $password)
{
throw new exception (dgettext("domframework",
"No authentication available"), 405);
}
/** Return all the parameters recorded for the authenticate user
*/
public function getdetails ()
{
throw new exception (dgettext("domframework",
"No getdetails available"), 405);
}
/** Method to change the password
* @param string $oldpassword The old password (to check if the user have the
* rights to change the password)
* @param string $newpassword The new password to be recorded
*/
public function changepassword ($oldpassword, $newpassword)
{
throw new exception (dgettext("domframework",
"No password change available"), 405);
}
/** Method to overwrite the password (without oldpassword check)
* Must be reserved to the administrators. For the users, use changepassword
* method
* @param string $email the user identifier to select
* @param string $newpassword The new password to be recorded
*/
public function overwritepassword ($email, $newpassword)
{
throw new exception (dgettext("domframework",
"No password overwrite available"), 405);
}
/** List all the users available in the database
* Return firstname, lastname, mail, with mail is an array
*/
public function listusers ()
{
throw new exception (dgettext("domframework",
"No List User available"), 405);
}
/** Method to disconnect the authenticated user
*/
public function logout ()
{
throw new exception (dgettext("domframework",
"No logout method available"), 405);
}
}