(api *simpleClient, password string)
| 948 | } |
| 949 | |
| 950 | func isToken(api *simpleClient, password string) bool { |
| 951 | api.PrepareRequest = func(req *http.Request) { |
| 952 | req.Header.Set("Authorization", "token "+password) |
| 953 | } |
| 954 | |
| 955 | res, _ := api.Get("user") |
| 956 | if res != nil && res.StatusCode == 200 { |
| 957 | return true |
| 958 | } |
| 959 | return false |
| 960 | } |
| 961 | |
| 962 | func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (token string, err error) { |
| 963 | api := client.apiClient() |
no test coverage detected
searching dependent graphs…