File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
app/Classes/LDAP/Attribute Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,13 @@ protected static function helpers(): Collection
52
52
public static function hash (string $ password ): ?Attribute \Password \Base
53
53
{
54
54
$ m = [];
55
- preg_match ('/^{([A -Z0-9]+)}(.*)$/ ' ,$ password ,$ m );
55
+ preg_match ('/^{([a-zA -Z0-9]+)}(.*)$/ ' ,$ password ,$ m );
56
56
57
- $ hash = \Arr::get ($ m ,1 ,'*clear* ' );
57
+ $ hash = strtoupper ($ x =\Arr::get ($ m ,1 ,'*clear* ' ));
58
+
59
+ // If our hash in the password is not in upper case, then convert it, as we use uppercase hashes to find the right class
60
+ if ($ hash !== $ x )
61
+ $ password = preg_replace ('/^{ ' .$ x .'}/ ' ,'{ ' .$ hash .'} ' ,$ password );
58
62
59
63
if (($ potential =static ::helpers ()->filter (fn ($ hasher )=>str_starts_with ($ hasher ::key,$ hash )))->count () > 1 ) {
60
64
foreach ($ potential as $ item ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ final class Crypt extends Base
11
11
12
12
public static function subid (string $ password ): bool
13
13
{
14
- return preg_match ('/^[\da-zA-Z ]{2}/ ' ,self ::password ($ password ));
14
+ return preg_match ('/^[\w ]{2}/ ' ,self ::password ($ password ));
15
15
}
16
16
17
17
public function compare (string $ source ,string $ compare ): bool
Original file line number Diff line number Diff line change 165
165
],
166
166
sprintf ('userpassword.%s%s.* ' ,\App \Ldap \Entry::TAG_NOTAG ,\App \Ldap \Entry::TAG_HELPER ) => [
167
167
'nullable ' ,
168
- 'min:4 '
168
+ 'min:3 '
169
169
],
170
170
sprintf ('userpassword.%s.* ' ,\App \Ldap \Entry::TAG_NOTAG ) => [
171
171
'nullable ' ,
You can’t perform that action at this time.
0 commit comments