Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

fix login with username and password for FB 7490 and OS 7.21 #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions config/fritzclientconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,3 @@ func New(path string) (*Config, error) {
func (config *Config) GetLoginURL() string {
return fmt.Sprintf("%s://%s:%s%s", config.Net.Protocol, config.Net.Host, config.Net.Port, config.Login.LoginURL)
}

// GetLoginResponseURL returns the URL that is queried for the login challenge
func (config *Config) GetLoginResponseURL(response string) string {
return fmt.Sprintf("%s?response=%s&username=%s", config.GetLoginURL(), response, config.Login.Username)
}
4 changes: 2 additions & 2 deletions fritz/fritzclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"

"github.com/bpicode/fritzctl/config"
"github.com/bpicode/fritzctl/httpread"
Expand Down Expand Up @@ -97,9 +98,8 @@ func (client *Client) solveChallenge() (*SessionInfo, error) {
func (client *Client) solveAttempt() func() (*http.Response, error) {
challengeAndPassword := client.SessionInfo.Challenge + "-" + client.Config.Login.Password
challengeResponse := client.SessionInfo.Challenge + "-" + toUTF16andMD5(challengeAndPassword)
url := client.Config.GetLoginResponseURL(challengeResponse)
return func() (*http.Response, error) {
return client.HTTPClient.Get(url)
return client.HTTPClient.PostForm(client.Config.GetLoginURL(), url.Values{"username": {client.Config.Login.Username}, "response": {challengeResponse}})
}
}

Expand Down