-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTools.php
More file actions
37 lines (32 loc) · 1.4 KB
/
Tools.php
File metadata and controls
37 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once 'Config.php';
require_once 'Language.php';
require_once 'Err.php';
final class Tools {
private $configInstance;
private $language;
public function isPasswordValid($password) {
if (strlen($password) < $this->configInstance::MINPASSWORDLENGTH) {
return new Err ($this->language->password_too_short);
}
if (!preg_match("/\d{" . $this->configInstance::MINNUMBERS . ",}/", $password)) {
return new Err ($this->language->password_not_enough_numbers);
}
if (!preg_match("/[A-Z]{" . $this->configInstance::MINUPPERCASELETTERS . ",}/", $password)) {
return new Err ($this->language->password_not_enough_uppercase);
}
if (!preg_match("/[a-z]{" . $this->configInstance::MINLOWERCASELETTERS . ",}/", $password)) {
return new Err ($this->language->password_not_enough_lowercase);
}
if (!preg_match("/\W{" . $this->configInstance::MINSPECIALCHARS . ",}/", $password)) {
return new Err ($this->language->password_not_enough_special);
}
return true;
}
public function __construct() {
$this->configInstance = Configuration::getInstance();
$l = new Language;
$this->language = $l->getCurrentLanguage();
}
}
?>