mirror of
https://github.com/Garmelon/PFERD.git
synced 2025-07-12 22:22:30 +02:00
Fix login using the native ilias login form
This commit is contained in:

committed by
I-Al-Istannen

parent
bdf17f5c87
commit
b305e1ce23
@ -25,6 +25,9 @@ ambiguous situations.
|
|||||||
## Changed
|
## Changed
|
||||||
- Explicitly mention that wikis are not supported at the moment and ignore them
|
- Explicitly mention that wikis are not supported at the moment and ignore them
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Ilias-native login
|
||||||
|
|
||||||
## 3.8.1 - 2025-04-17
|
## 3.8.1 - 2025-04-17
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
@ -1039,7 +1039,7 @@ instance's greatest bottleneck.
|
|||||||
async with self.session.get(urljoin(self._base_url, "/login.php"), params=params) as request:
|
async with self.session.get(urljoin(self._base_url, "/login.php"), params=params) as request:
|
||||||
login_page = soupify(await request.read())
|
login_page = soupify(await request.read())
|
||||||
|
|
||||||
login_form = cast(Optional[Tag], login_page.find("form", attrs={"name": "formlogin"}))
|
login_form = cast(Optional[Tag], login_page.find("form", attrs={"name": "login_form"}))
|
||||||
if login_form is None:
|
if login_form is None:
|
||||||
raise CrawlError("Could not find the login form! Specified client id might be invalid.")
|
raise CrawlError("Could not find the login form! Specified client id might be invalid.")
|
||||||
|
|
||||||
@ -1049,14 +1049,12 @@ instance's greatest bottleneck.
|
|||||||
|
|
||||||
username, password = await self._auth.credentials()
|
username, password = await self._auth.credentials()
|
||||||
|
|
||||||
login_data = {
|
login_form_data = aiohttp.FormData()
|
||||||
"username": username,
|
login_form_data.add_field('login_form/input_3/input_4', username)
|
||||||
"password": password,
|
login_form_data.add_field('login_form/input_3/input_5', password)
|
||||||
"cmd[doStandardAuthentication]": "Login",
|
|
||||||
}
|
|
||||||
|
|
||||||
# do the actual login
|
# do the actual login
|
||||||
async with self.session.post(urljoin(self._base_url, login_url), data=login_data) as request:
|
async with self.session.post(urljoin(self._base_url, login_url), data=login_form_data) as request:
|
||||||
soup = IliasSoup(soupify(await request.read()), str(request.url))
|
soup = IliasSoup(soupify(await request.read()), str(request.url))
|
||||||
if not IliasPage.is_logged_in(soup):
|
if not IliasPage.is_logged_in(soup):
|
||||||
self._auth.invalidate_credentials()
|
self._auth.invalidate_credentials()
|
||||||
|
Reference in New Issue
Block a user