*/ /** User authentication (abstract class) */ class auth { /** 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|null $message Message to display to the user @param string|null $url URL to go back after successful authentication */ public function pageHTML ($baseURL, $message="", $url="", $alreadyAuth=false) { $res = ""; $res .= "\n"; $res .= "\n"; $res .= "\n"; $res .= "".dgettext("domframework", "Sign in")."\n"; $res .= "\n"; $res .= " \n"; // $res .= " \n"; $res .= " \n"; } else { $res .= "

".dgettext("domframework", "Already sign in"); $res .= "

\n"; if (is_string ($alreadyAuth)) $res .= "

$alreadyAuth

\n"; $res .= "

". dgettext ("domframework", "Click here to logout")."

\n"; if ($url !== "") $res .= "

". dgettext ("domframework", "Go back to the calling page"). "

\n"; } if ($message !== "" && $message !== null) $res .= "
$message
\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); } public function logout () { throw new exception (dgettext("domframework", "No logout method available"), 405); } }