Automatic pass to convert with php-cs-fixer
This commit is contained in:
@@ -1,26 +1,34 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework;
|
||||
|
||||
/** User authentication against .htpasswd file
|
||||
A .htpasswd can be created by the 'htpasswd' command for Apache, and contain
|
||||
toto@toto.com:$2y$05$uHCUNqicE7Pku3MK1qZaDuJxP/pocqCcEAnacZBjsfWgW9EcuG5y2
|
||||
*/
|
||||
/**
|
||||
* User authentication against .htpasswd file
|
||||
* A .htpasswd can be created by the 'htpasswd' command for Apache, and contain
|
||||
* toto@toto.com:$2y$05$uHCUNqicE7Pku3MK1qZaDuJxP/pocqCcEAnacZBjsfWgW9EcuG5y2
|
||||
*/
|
||||
class Authhtpasswd extends Auth
|
||||
{
|
||||
/** The .htpasswd file to use for authentication */
|
||||
/**
|
||||
* The .htpasswd file to use for authentication
|
||||
*/
|
||||
public $htpasswdFile;
|
||||
|
||||
/** The details to return if the user is authenticated */
|
||||
/**
|
||||
* The details to return if the user is authenticated
|
||||
*/
|
||||
private $details = null;
|
||||
|
||||
/** There is no real connection to htpasswd */
|
||||
/**
|
||||
* There is no real connection to htpasswd
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
if (! file_exists($this->htpasswdFile)) {
|
||||
@@ -43,9 +51,11 @@ class Authhtpasswd extends Auth
|
||||
}
|
||||
}
|
||||
|
||||
/** Try to authenticate the email/password of the user
|
||||
@param string $email Email to authenticate
|
||||
@param string $password Password to authenticate */
|
||||
/**
|
||||
* Try to authenticate the email/password of the user
|
||||
* @param string $email Email to authenticate
|
||||
* @param string $password Password to authenticate
|
||||
*/
|
||||
public function authentication($email, $password)
|
||||
{
|
||||
// Redo the checks of connect to not have a property to add
|
||||
@@ -70,23 +80,27 @@ class Authhtpasswd extends Auth
|
||||
if (crypt($password, $cryptedPassword) !== $cryptedPassword) {
|
||||
throw new \Exception("Bad password for '$email'", 401);
|
||||
}
|
||||
$this->details = array("email" => $email);
|
||||
$this->details = ["email" => $email];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
throw new \Exception("Unable to find the user : '$email'", 401);
|
||||
}
|
||||
|
||||
/** Return all the parameters recorded for the authenticate user */
|
||||
/**
|
||||
* Return all the parameters recorded for the authenticate user
|
||||
*/
|
||||
public function getdetails()
|
||||
{
|
||||
return $this->details;
|
||||
}
|
||||
|
||||
/** 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 */
|
||||
/**
|
||||
* 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(
|
||||
@@ -98,11 +112,13 @@ class Authhtpasswd extends Auth
|
||||
);
|
||||
}
|
||||
|
||||
/** 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 */
|
||||
/**
|
||||
* 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(
|
||||
|
||||
Reference in New Issue
Block a user