// PasswordResetRequest sends a password reset email to the provided email address.
356646
func (c *Client) PasswordResetRequest(email string) error {
	payload, err := json.Marshal(struct {
		Email string `json:"email"`
	}{Email: email})
	if err != nil {
		return err
	}
	uri := "/1/requestPasswordReset"
	resp, err := c.doSimple("GET", uri)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	c.trace("PasswordResetRequest", uri, string(payload))
	return err
}
197480
func (a *Authenticator) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error) {
	username, password, found := req.BasicAuth()
	if !found {
		return nil, false, nil
	}

	resp, ok, err := a.auth.AuthenticatePassword(req.Context(), username, password)

	// If the password authenticator didn't error, provide a default error
	if !ok && err == nil {
		err = errInvalidAuth
	}

	return resp, ok, err
}
1298828
func (o *AcceptLoginRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	if o.Body != nil {
		if err := r.SetBodyParam(o.Body); err != nil {
			return err
		}
	}

	// query param login_challenge
	qrLoginChallenge := o.LoginChallenge
	qLoginChallenge := qrLoginChallenge
	if qLoginChallenge != "" {
		if err := r.SetQueryParam("login_challenge", qLoginChallenge); err != nil {
			return err
		}
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
1019505
func (c *CredentialsStore) CheckRequest(b BasicAuther) bool {
	username, password, ok := b.BasicAuth()
	if !ok || !c.Check(username, password) {
		return false
	}
	return true
}
8327
func (s *CreateLoginProfileInput) SetPasswordResetRequired(v bool) *CreateLoginProfileInput {
	s.PasswordResetRequired = &v
	return s
}
1076909
func (_m *API) ResetHostKey(_a0 string) ([]byte, error) {
	ret := _m.Called(_a0)

	var r0 []byte
	if rf, ok := ret.Get(0).(func(string) []byte); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]byte)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1088536
func (r Network_Storage_Allowed_Host_IpAddress) SetCredentialPassword(password *string) (resp bool, err error) {
	params := []interface{}{
		password,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Storage_Allowed_Host_IpAddress", "setCredentialPassword", params, &r.Options, &resp)
	return
}
684489
func (s *Service) PasswordResetCompleteResetPassword(ctx context.Context, passwordResetResetPasswordToken string, o PasswordResetCompleteResetPasswordOpts) (*PasswordReset, error) {
	var passwordReset PasswordReset
	return &passwordReset, s.Post(ctx, &passwordReset, fmt.Sprintf("/password-resets/%v/actions/finalize", passwordResetResetPasswordToken), o)
}
316101
func (c Client) SendRequest(r *MailRequest) (string, error) {
	// https://help.aliyun.com/document_detail/29440.html?spm=5176.doc29444.2.1.hYchmR
	ps := parameters.NewParameterSet()
	ps.Add("Format", "JSON")
	ps.Add("Version", "2015-11-23")
	ps.Add("AccessKeyId", c.AccessKeyID)
	ps.Add("SignatureMethod", "HMAC-SHA1")
	ps.Add("Timestamp", time.Now().UTC().Format("2006-01-02T15:04:05Z"))
	ps.Add("SignatureVersion", "1.0")
	id, _ := uuid.NewV4()
	ps.Add("SignatureNonce", id.String())

	ps.Add("Action", r.Action)
	ps.Add("AccountName", r.AccountName)
	if r.ReplyToAddress {
		ps.Add("ReplyToAddress", "true")
	} else {
		ps.Add("ReplyToAddress", "false")
	}
	ps.Add("AddressType", strconv.Itoa(r.AddressType))
	ps.Add("ToAddress", r.ToAddress)
	if len(r.FromAlias) > 0 {
		ps.Add("FromAlias", r.FromAlias)
	}
	if len(r.Subject) > 0 {
		ps.Add("Subject", r.Subject)
	}
	if len(r.HtmlBody) > 0 {
		ps.Add("HtmlBody", r.HtmlBody)
	}
	if len(r.TextBody) > 0 {
		ps.Add("TextBody", r.TextBody)
	}

	ps.Add("Signature", ps.Sign(ps.GetStringToSign(), c.AccessKeySecret))
	resp, err := http.Get(baseURL + "?" + ps.Concatenate())
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return "failed to read response", err
	}
	if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
		return string(body), errors.New("response code isn't ok")
	}

	var v map[string]string
	dec := json.NewDecoder(bytes.NewReader(body))
	if err := dec.Decode(&v); err != nil {
		return "", err
	}
	if _, ok := v["Code"]; ok {
		return "", errors.New("response doesn't contain Code")
	}
	return string(body), nil
}
995841
func NewRequest(username, password string) Request {
	invalidCh := make(chan InvalidPassword)
	createdCh := make(chan CreatedUser)
	authenticatedCh := make(chan AuthenticatedUser)

	return Request{
		Time:     filu.Now(),
		Username: username,
		Password: password,

		InvalidPassword:   invalidCh,
		CreatedUser:       createdCh,
		AuthenticatedUser: authenticatedCh,

		sendInvalidPassword:   invalidCh,
		sendCreatedUser:       createdCh,
		sendAuthenticatedUser: authenticatedCh,
	}
}
685206
func (s *UsersService) UpdatePassword(username string, body UsersUsernamePasswordPutReqBody, headers, queryParams map[string]interface{}) (*http.Response, error) {
	var err error

	resp, err := s.client.doReqWithBody("PUT", s.client.BaseURI+"/users/"+username+"/password", &body, headers, queryParams)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case 422:
		var respBody422 Error
		err = goraml.NewAPIError(resp, &respBody422)
	default:
		err = goraml.NewAPIError(resp, nil)
	}

	return resp, err
}
814044
func (auth *Auth) SendPasswordResetEmail(ctx context.Context, email string) error {
	_, err := auth.client.GetOobConfirmationCode(&identitytoolkit.Relyingparty{
		Email:       email,
		RequestType: "PASSWORD_RESET",
	}).Context(ctx).Do()
	if err != nil {
		return err
	}
	return nil
}
187832
func NewRequest(username, password, method, uri, body string) DigestRequest {
	dr := DigestRequest{}
	dr.UpdateRequest(username, password, method, uri, body)
	dr.CertVal = true
	return dr
}
838431
func (api *UserManagerAPI) SetPassword(args params.EntityPasswords) (params.ErrorResults, error) {
	if err := api.check.ChangeAllowed(); err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}

	var result params.ErrorResults

	if len(args.Changes) == 0 {
		return result, nil
	}

	// Create the results list to populate.
	result.Results = make([]params.ErrorResult, len(args.Changes))
	for i, arg := range args.Changes {
		if err := api.setPassword(arg); err != nil {
			result.Results[i].Error = common.ServerError(err)
		}
	}
	return result, nil
}
55600
func (d *DNSProvider) postRequest(cmd string, data url.Values) (*response, error) {
	uri := d.config.BaseURL + cmd

	if d.config.AuthSid != "" {
		data.Set("auth-sid", d.config.AuthSid)
	}

	if d.config.Debug {
		log.Infof("postRequest:\n\tURL: %q\n\tData: %v", uri, data)
	}

	resp, err := d.config.HTTPClient.PostForm(uri, data)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("HTTP error %d [%s]: %v", resp.StatusCode, http.StatusText(resp.StatusCode), string(body))
	}

	return parseResponse(string(body)), nil
}
1218864
func sanitizeRequest(r *btcjson.Request) string {
	// These are considered unsafe to log, so sanitize parameters.
	switch r.Method {
	case "encryptwallet", "importprivkey", "importwallet",
		"signrawtransaction", "walletpassphrase",
		"walletpassphrasechange":

		return fmt.Sprintf(`{"id":%v,"method":"%s","params":SANITIZED %d parameters}`,
			r.ID, r.Method, len(r.Params))
	}

	return fmt.Sprintf(`{"id":%v,"method":"%s","params":%v}`, r.ID,
		r.Method, r.Params)
}
248856
func (rki RevokedKeyInfo) ResetInfo() (keybase1.Seqno, bool) {
	return rki.resetSeqno, rki.isReset
}