Commit bc44a9c and authored Feb 5, 2022 Verified
1 parent e011981 commit bc44a9c Copy full SHA for bc44a9c
File tree 3 files changed +2
-110
lines changed
3 files changed +2
-110
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ protected function fireLockoutEvent(Request $request)
89
89
*/
90
90
protected function throttleKey (Request $ request )
91
91
{
92
- return $ this -> removeSpecialCharacters (Str::lower ($ request ->input ($ this ->username ())).'| ' .$ request ->ip ());
92
+ return Str:: transliterate (Str::lower ($ request ->input ($ this ->username ())).'| ' .$ request ->ip ());
93
93
}
94
94
95
95
/**
@@ -121,86 +121,4 @@ public function decayMinutes()
121
121
{
122
122
return property_exists ($ this , 'decayMinutes ' ) ? $ this ->decayMinutes : 1 ;
123
123
}
124
-
125
- /**
126
- * Remove special characters that may allow users to bypass rate limiting.
127
- *
128
- * @param string $key
129
- * @return string
130
- */
131
- protected function removeSpecialCharacters ($ key )
132
- {
133
- $ values = [
134
- 'ⓐ ' => 'a ' ,
135
- 'ⓑ ' => 'b ' ,
136
- 'ⓒ ' => 'c ' ,
137
- 'ⓓ ' => 'd ' ,
138
- 'ⓔ ' => 'e ' ,
139
- 'ⓕ ' => 'f ' ,
140
- 'ⓖ ' => 'g ' ,
141
- 'ⓗ ' => 'h ' ,
142
- 'ⓘ ' => 'i ' ,
143
- 'ⓙ ' => 'j ' ,
144
- 'ⓚ ' => 'k ' ,
145
- 'ⓛ ' => 'l ' ,
146
- 'ⓜ ' => 'm ' ,
147
- 'ⓝ ' => 'n ' ,
148
- 'ⓞ ' => 'o ' ,
149
- 'ⓟ ' => 'p ' ,
150
- 'ⓠ ' => 'q ' ,
151
- 'ⓡ ' => 'r ' ,
152
- 'ⓢ ' => 's ' ,
153
- 'ⓣ ' => 't ' ,
154
- 'ⓤ ' => 'u ' ,
155
- 'ⓥ ' => 'v ' ,
156
- 'ⓦ ' => 'w ' ,
157
- 'ⓧ ' => 'x ' ,
158
- 'ⓨ ' => 'y ' ,
159
- 'ⓩ ' => 'z ' ,
160
- '① ' => '1 ' ,
161
- '② ' => '2 ' ,
162
- '③ ' => '3 ' ,
163
- '④ ' => '4 ' ,
164
- '⑤ ' => '5 ' ,
165
- '⑥ ' => '6 ' ,
166
- '⑦ ' => '7 ' ,
167
- '⑧ ' => '8 ' ,
168
- '⑨ ' => '9 ' ,
169
- '⑩ ' => '10 ' ,
170
- '⑪ ' => '11 ' ,
171
- '⑫ ' => '12 ' ,
172
- '⑬ ' => '13 ' ,
173
- '⑭ ' => '14 ' ,
174
- '⑮ ' => '15 ' ,
175
- '⑯ ' => '16 ' ,
176
- '⑰ ' => '17 ' ,
177
- '⑱ ' => '18 ' ,
178
- '⑲ ' => '19 ' ,
179
- '⑳ ' => '20 ' ,
180
- '⓪ ' => '0 ' ,
181
- '⓵ ' => '1 ' ,
182
- '⓶ ' => '2 ' ,
183
- '⓷ ' => '3 ' ,
184
- '⓸ ' => '4 ' ,
185
- '⓹ ' => '5 ' ,
186
- '⓺ ' => '6 ' ,
187
- '⓻ ' => '7 ' ,
188
- '⓼ ' => '8 ' ,
189
- '⓽ ' => '9 ' ,
190
- '⓾ ' => '10 ' ,
191
- '⓫ ' => '11 ' ,
192
- '⓬ ' => '12 ' ,
193
- '⓭ ' => '13 ' ,
194
- '⓮ ' => '14 ' ,
195
- '⓯ ' => '15 ' ,
196
- '⓰ ' => '16 ' ,
197
- '⓱ ' => '17 ' ,
198
- '⓲ ' => '18 ' ,
199
- '⓳ ' => '19 ' ,
200
- '⓴ ' => '20 ' ,
201
- '⓿ ' => '0 ' ,
202
- ];
203
-
204
- return strtr ($ key , $ values );
205
- }
206
124
}
Original file line number Diff line number Diff line change 13
13
"php" : " ^7.3|^8.0" ,
14
14
"illuminate/console" : " ^8.42|^9.0" ,
15
15
"illuminate/filesystem" : " ^8.42|^9.0" ,
16
- "illuminate/support" : " ^8.42 |^9.0" ,
16
+ "illuminate/support" : " ^8.82 |^9.0" ,
17
17
"illuminate/validation" : " ^8.42|^9.0"
18
18
},
19
19
"require-dev" : {
Original file line number Diff line number Diff line change 9
9
10
10
class ThrottleLoginsTest extends TestCase
11
11
{
12
- /**
13
- * @test
14
- * @dataProvider specialCharacterProvider
15
- */
16
- public function it_can_replace_special_characters (string $ value , string $ expected ): void
17
- {
18
- $ throttle = $ this ->getMockForTrait (ThrottlesLogins::class);
19
- $ reflection = new \ReflectionClass ($ throttle );
20
- $ method = $ reflection ->getMethod ('removeSpecialCharacters ' );
21
- $ method ->setAccessible (true );
22
-
23
- $ this ->assertSame ($ expected , $ method ->invoke ($ throttle , $ value ));
24
- }
25
-
26
- public function specialCharacterProvider (): array
27
- {
28
- return [
29
- ['ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ ' , 'abcdefghijklmnopqrstuvwxyz ' ],
30
- ['⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳ ' , '01234567891011121314151617181920 ' ],
31
- ['⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾ ' , '12345678910 ' ],
32
- ['⓿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴ ' , '011121314151617181920 ' ],
33
- ['abcdefghijklmnopqrstuvwxyz ' , 'abcdefghijklmnopqrstuvwxyz ' ],
34
- ['0123456789 ' , '0123456789 ' ],
35
- ];
36
- }
37
-
38
12
/**
39
13
* @test
40
14
* @dataProvider emailProvider
You can’t perform that action at this time.
0 commit comments