| <?php |
| require_once 'vendor/autoload.php'; |
| |
| class User |
| { |
| public $username; |
| public $name; |
| public $first_name; |
| public $last_name; |
| public $email; |
| public $organization; |
| public $user_hash; |
| public $password; |
| function __construct() |
| { |
| $this->username = ""; |
| $this->name = ""; |
| $this->first_name = ""; |
| $this->last_name = ""; |
| $this->email = ""; |
| $this->organization = ""; |
| $this->user_hash = ""; |
| $this->password = ""; |
| } |
| |
| function __construct6(string $username, string $first_name, string $last_name, string $email, string $password, string $organization) |
| { |
| include 'config.php'; |
| $this->username = $username; |
| $this->name = $first_name; |
| $this->first_name = $first_name; |
| $this->last_name = $last_name; |
| $this->email = $email; |
| $this->organization = $organization; |
| $this->set_password($password); |
| |
| } |
| |
| function set_password(string $password) |
| { |
| include 'config.php'; |
| if ($ENCRYPT_PASSWORDS) { |
| $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$'); |
| # $this->user_hash = "{SHA}" . base64_encode(sha1($password, true)); |
| } else { |
| $this->user_hash = "{CLEAR}" . $password; |
| } |
| $this->password = $this->user_hash; |
| } |
| } |
| |
| ?> |