Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
framawiki committed Nov 15, 2017
1 parent af06a68 commit 3e68481
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion huggle/apiquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void ApiQuery::SetAction(const Action action)
this->ActionPart = "login";
this->EnforceLogin = false;
return;
case ClientLogin:
case ActionClientLogin:
this->ActionPart = "clientlogin";
this->EnforceLogin = false;
return;
Expand Down
2 changes: 1 addition & 1 deletion huggle/apiquery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Huggle
ActionClearHasMsg,
ActionQuery,
ActionLogin,
ClientLogin,
ActionClientLogin,
ActionLogout,
//ActionTokens,
ActionPurge,
Expand Down
8 changes: 5 additions & 3 deletions huggle/login.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void Login::PerformLoginPart2(WikiSite *site)
this->Statuses[site] = WaitingForToken;
this->LoginQueries.remove(site);
query->DecRef();
query = new ApiQuery(ClientLogin, site);
query = new ApiQuery(ActionClientLogin, site);
this->LoginQueries.insert(site, query);
//query->HiddenQuery = true;
query->IncRef();
Expand Down Expand Up @@ -1286,12 +1286,14 @@ bool Login::ProcessOutput(WikiSite *site)
if (true){
// 2FA is requierd (TOTP code needed)
QString totp = QInputDialog::getText(this, "Two factor authentification", "Please enter the 2FA code from your device:");
query = new ApiQuery(ClientLogin, site);
query = new ApiQuery(ActionClientLogin, site);
//query->HiddenQuery = true;
query->IncRef();
query->Parameters = "username=" + QUrl::toPercentEncoding(hcfg->SystemConfig_BotLogin)
+ "&password=" + QUrl::toPercentEncoding(hcfg->TemporaryConfig_Password)
+ "&OATHToken=" + totp + "&loginreturnurl=http://example.com/&rememberMe=1&logintoken=" + QUrl::toPercentEncoding(this->Tokens[site]);
+ "&OATHToken=" + totp +
+ "&logintoken=" + QUrl::toPercentEncoding(this->Tokens[site])
+ "&logincontinue=1&rememberMe=1";
query->UsingPOST = true;
query->Process();
ApiQueryResult *result = query->GetApiQueryResult();
Expand Down

0 comments on commit 3e68481

Please sign in to comment.