Skip to content

Commit

Permalink
Merge "Pass login token when using action=login"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jan 27, 2024
2 parents bbb1a78 + c939a60 commit 0af6739
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pywikibot/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,21 @@ def _login_parameters(self, *, botpassword: bool = False
if botpassword:
self.action = 'login'
else:
token = self.site.tokens['login']
self.action = 'clientlogin'

# prepare default login parameters
parameters = {'action': self.action,
self.keyword('user'): self.login_name,
self.keyword('password'): self.password}

if self.action == 'login':
parameters['lgtoken'] = self.site.tokens['login']

if self.action == 'clientlogin':
# clientlogin requires non-empty loginreturnurl
parameters['loginreturnurl'] = 'https://example.com'
parameters['rememberMe'] = '1'
parameters['logintoken'] = token
parameters['logintoken'] = self.site.tokens['login']

if self.site.family.ldapDomain:
parameters[self.keyword('ldap')] = self.site.family.ldapDomain
Expand Down

0 comments on commit 0af6739

Please sign in to comment.