Always return valid regex
This commit is contained in:
parent
67f407635b
commit
5c3f6bb530
@ -164,7 +164,7 @@
|
|||||||
* Valid for both php and javascript
|
* Valid for both php and javascript
|
||||||
*/
|
*/
|
||||||
public static function passRegex() {
|
public static function passRegex() {
|
||||||
static $regex = "";
|
$regex = "";
|
||||||
if (self::$pass_strength > 0) {
|
if (self::$pass_strength > 0) {
|
||||||
// lower and upper case
|
// lower and upper case
|
||||||
$regex .= "(?=.*[a-z])(?=.*[A-Z])";
|
$regex .= "(?=.*[a-z])(?=.*[A-Z])";
|
||||||
@ -180,10 +180,10 @@
|
|||||||
if (self::$pass_lenmin > 0) {
|
if (self::$pass_lenmin > 0) {
|
||||||
$regex .= "(?=.{" . self::$pass_lenmin . ",})";
|
$regex .= "(?=.{" . self::$pass_lenmin . ",})";
|
||||||
}
|
}
|
||||||
if (!empty($regex)) {
|
if (empty($regex)) {
|
||||||
$regex = "/" . $regex . "/";
|
$regex = ".*";
|
||||||
}
|
}
|
||||||
return $regex;
|
return "/" . $regex . "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
*/
|
*/
|
||||||
public function setPass($pass) {
|
public function setPass($pass) {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if ($this->validPassStrength($pass)) {
|
if (!empty($this->login) && !empty($pass) && $this->validPassStrength($pass)) {
|
||||||
$hash = password_hash($pass, PASSWORD_DEFAULT);
|
$hash = password_hash($pass, PASSWORD_DEFAULT);
|
||||||
$sql = "UPDATE `" . self::$db->table('users') . "` SET password = ? WHERE login = ?";
|
$sql = "UPDATE `" . self::$db->table('users') . "` SET password = ? WHERE login = ?";
|
||||||
$stmt = self::$db->prepare($sql);
|
$stmt = self::$db->prepare($sql);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user