// GetLogin handles GET: http://localhost:8080/user/login.
968883
func (c *UserController) GetLogin() mvc.Result {
	if c.isLoggedIn() {
		// if it's already logged in then destroy the previous session.
		c.logout()
	}

	return loginStaticView
}
14612
func (m *MarketplacePlanAccount) GetLogin() string {
	if m == nil || m.Login == nil {
		return ""
	}
	return *m.Login
}
349522
func GetUserByLoginOrEmail(c *m.ReqContext) Response {
	query := m.GetUserByLoginQuery{LoginOrEmail: c.Query("loginOrEmail")}
	if err := bus.Dispatch(&query); err != nil {
		if err == m.ErrUserNotFound {
			return Error(404, m.ErrUserNotFound.Error(), nil)
		}
		return Error(500, "Failed to get user", err)
	}
	user := query.Result
	result := m.UserProfileDTO{
		Id:             user.Id,
		Name:           user.Name,
		Email:          user.Email,
		Login:          user.Login,
		Theme:          user.Theme,
		IsGrafanaAdmin: user.IsAdmin,
		OrgId:          user.OrgId,
	}
	return JSON(200, &result)
}
1118251
func (m *MockUser) Get(arg0 content.Login) (content.User, error) {
	ret := m.ctrl.Call(m, "Get", arg0)
	ret0, _ := ret[0].(content.User)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
710500
func (c *Client) GetUser(userID string) (*User, error) {
	uri := fmt.Sprintf("/1/users/%s", userID)
	resp, err := c.doSimple("GET", uri)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	c.trace("GetUser", uri, string(body))
	var user *User
	// TODO(tmc): warn if not == .Zero() before populating?
	return user, json.Unmarshal(body, &user)
}
318114
func (o *Organization) GetLogin() string {
	if o == nil || o.Login == nil {
		return ""
	}
	return *o.Login
}
904703
func (a *API) GetUser(user int) (*User, error) {
	dst := new(User)
	url := a.BuildURL("/v2/user/%d", user)
	err := a.Get(url, Params{}, dst)
	return dst, err
}
250104
func (state *UserState) Login(w http.ResponseWriter, username string) error {
	state.SetLoggedIn(username)
	return state.SetUsernameCookie(w, username)
}
888994
func (n *nessusImpl) Login(username, password string) error {
	if n.verbose {
		log.Printf("Login into %s\n", n.apiURL)
	}
	data := loginRequest{
		Username: username,
		Password: password,
	}

	resp, err := n.doRequest("POST", "/session", data, []int{http.StatusOK})
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	reply := &loginResp{}
	if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
		return err
	}
	n.authCookie = reply.Token
	return nil
}
389054
func (s *UserService) GetUser(p *GetUserParams) (*GetUserResponse, error) {
	resp, err := s.cs.newRequest("getUser", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r GetUserResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
112560
func (c *Client) GetAuth(accessToken string) (resp GetAuthResponse, err error) {
	options := GetAuthOptions{
		AccountIDs: []string{},
	}
	return c.GetAuthWithOptions(accessToken, options)
}
195876
func (u *User) GetURL() string {
	if u == nil || u.URL == nil {
		return ""
	}
	return *u.URL
}
669117
func Login(email, password, androidID string, service ...string) (auth string, err error) {
	token, err := GetToken(email, password, androidID)
	if err != nil {
		return "", err
	}
	return OAuth(email, token, androidID, service...)
}
255924
func (c *ServerConn) Login(user, password string) error {
	code, message, err := c.cmd(-1, "USER %s", user)
	if err != nil {
		return err
	}

	switch code {
	case StatusLoggedIn:
	case StatusUserOK:
		_, _, err = c.cmd(StatusLoggedIn, "PASS %s", password)
		if err != nil {
			return err
		}
	default:
		return errors.New(message)
	}

	// Switch to binary mode
	if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil {
		return err
	}

	// Switch to UTF-8
	err = c.setUTF8()

	return err
}
17686
func (c *Client) Login(ctx context.Context, user *url.Userinfo) error {
	req := internal.URL(c, internal.SessionPath).Request(http.MethodPost)

	if user != nil {
		if password, ok := user.Password(); ok {
			req.SetBasicAuth(user.Username(), password)
		}
	}

	return c.Do(ctx, req, nil)
}
712371
func UserLogin(username, password string, loginSourceID int64) (*User, error) {
	var user *User
	if strings.Contains(username, "@") {
		user = &User{Email: strings.ToLower(username)}
	} else {
		user = &User{LowerName: strings.ToLower(username)}
	}

	hasUser, err := x.Get(user)
	if err != nil {
		return nil, fmt.Errorf("get user record: %v", err)
	}

	if hasUser {
		// Note: This check is unnecessary but to reduce user confusion at login page
		// and make it more consistent at user's perspective.
		if loginSourceID >= 0 && user.LoginSource != loginSourceID {
			return nil, errors.LoginSourceMismatch{loginSourceID, user.LoginSource}
		}

		// Validate password hash fetched from database for local accounts
		if user.LoginType == LOGIN_NOTYPE ||
			user.LoginType == LOGIN_PLAIN {
			if user.ValidatePassword(password) {
				return user, nil
			}

			return nil, errors.UserNotExist{user.ID, user.Name}
		}

		// Remote login to the login source the user is associated with
		source, err := GetLoginSourceByID(user.LoginSource)
		if err != nil {
			return nil, err
		}

		return remoteUserLogin(user, user.LoginName, password, source, false)
	}

	// Non-local login source is always greater than 0
	if loginSourceID <= 0 {
		return nil, errors.UserNotExist{-1, username}
	}

	source, err := GetLoginSourceByID(loginSourceID)
	if err != nil {
		return nil, err
	}

	return remoteUserLogin(nil, username, password, source, true)
}
1286486
func (c *CommitAuthor) GetLogin() string {
	if c == nil || c.Login == nil {
		return ""
	}
	return *c.Login
}