Marc Kupietz | 0215a44 | 2023-03-05 18:34:16 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once 'vendor/autoload.php'; |
| 3 | |
| 4 | class User |
| 5 | { |
| 6 | public $user_name; |
| 7 | public $name; |
| 8 | public $first_name; |
| 9 | public $last_name; |
| 10 | public $email; |
| 11 | public $organization; |
| 12 | public $user_hash; |
| 13 | public $password; |
| 14 | |
| 15 | function __construct(string $user_name, string $first_name, string $last_name, string $email, string $password, string $organization) |
| 16 | { |
| 17 | include 'config.php'; |
| 18 | $this->user_name = $user_name; |
| 19 | $this->name = $first_name; |
| 20 | $this->first_name = $first_name; |
| 21 | $this->last_name = $last_name; |
| 22 | $this->email = $email; |
| 23 | $this->organization = $organization; |
| 24 | if ($ENCRYPT_PASSWORDS) { |
| 25 | $this->user_hash = "{crypt}" . crypt($password, '$6$' . generateSalt(10) . '$'); |
| 26 | # $this->user_hash = "{SHA}" . base64_encode(sha1($password, true)); |
| 27 | } else { |
| 28 | $this->user_hash = "{CLEAR}" . $password; |
| 29 | } |
| 30 | $this->password = $this->user_hash; |
| 31 | |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | ?> |