Skip to content

Commit c374bbf

Browse files
icewind1991rullzer
authored andcommitted
allow authenticating using urlencoded passwords
this allows authenticating with passwords that contain non ascii-characters in contexts that otherwise do not allow it (http basic) Signed-off-by: Robin Appelman <[email protected]>
1 parent 2dd04f7 commit c374bbf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/private/User/Manager.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@ public function checkPasswordNoLogging($loginName, $password) {
231231
}
232232
}
233233

234+
// since http basic auth doesn't provide a standard way of handling non ascii password we allow password to be urlencoded
235+
// we only do this decoding after using the plain password fails to maintain compatibility with any password that happens
236+
// to contains urlencoded patterns by "accident".
237+
$password = urldecode($password);
238+
239+
foreach ($this->backends as $backend) {
240+
if ($backend->implementsActions(Backend::CHECK_PASSWORD)) {
241+
$uid = $backend->checkPassword($loginName, $password);
242+
if ($uid !== false) {
243+
return $this->getUserObject($uid, $backend);
244+
}
245+
}
246+
}
247+
234248
return false;
235249
}
236250

0 commit comments

Comments
 (0)