// NewLogin creates a Login engine.  username is optional.
// deviceType should be libkb.DeviceTypeDesktop or
// libkb.DeviceTypeMobile.
488983
func NewLogin(g *libkb.GlobalContext, deviceType string, username string, ct keybase1.ClientType) *Login {
	return NewLoginWithUserSwitch(g, deviceType, username, ct, false)
}
560246
func (m *Module) Login(email, password string) (string, bool, error) {
	email = strings.ToLower(email)
	userID, hashedPassword, err := m.userStore.Get(email)
	if err != nil {
		return "", false, err
	}
	return userID, AuthenticatePassword(password, hashedPassword), nil
}
416749
func NewLoginFailType(Description string) *LoginFailType {
	s := new(LoginFailType)
	s.Description = Description
	return s
}
878149
func (n *RequestObserver) Login(entity names.Tag, model names.ModelTag, fromController bool, userData string) {
	n.state.tag = entity.String()
	n.state.fromController = fromController
	if n.isAgent(entity) {
		n.state.agent = true
		n.state.model = model.Id()
		// Don't log connections from the controller to the model.
		if !n.state.fromController {
			n.connLogger.Infof("agent login: %s for %s", n.state.tag, n.state.model)
		}
		n.hub.Publish(apiserver.ConnectTopic, apiserver.APIConnection{
			AgentTag:        n.state.tag,
			ControllerAgent: fromController,
			ModelUUID:       model.Id(),
			ConnectionID:    n.state.id,
			UserData:        userData,
		})
	}
}
971252
func newEntry() *Entry {
	e := logrus.NewEntry(logger)
	addContext(e.Data, defaultDepth)
	return &Entry{*e}
}
340997
func NewLogoutUser(ctx *middleware.Context, handler LogoutUserHandler) *LogoutUser {
	return &LogoutUser{Context: ctx, Handler: handler}
}
82895
func NewLoginUser(ctx *middleware.Context, handler LoginUserHandler) *LoginUser {
	return &LoginUser{Context: ctx, Handler: handler}
}
202809
func newLoginProvision(g *libkb.GlobalContext, arg *loginProvisionArg) *loginProvision {
	return &loginProvision{
		Contextified: libkb.NewContextified(g),
		arg:          arg,
	}
}
792743
func Login() string {
	// Login
	l := os.Getenv("STOMP_LOGIN")
	if l != "" {
		login = l
	}
	if l == "NONE" {
		login = ""
	}
	return login
}
386286
func (c *Client) Login(username, password string) error {
	if state := c.State(); state == imap.AuthenticatedState || state == imap.SelectedState {
		return ErrAlreadyLoggedIn
	}

	c.locker.Lock()
	loginDisabled := c.caps != nil && c.caps["LOGINDISABLED"]
	c.locker.Unlock()
	if loginDisabled {
		return ErrLoginDisabled
	}

	cmd := &commands.Login{
		Username: username,
		Password: password,
	}

	status, err := c.execute(cmd, nil)
	if err != nil {
		return err
	}
	if err = status.Err(); err != nil {
		return err
	}

	c.locker.Lock()
	c.state = imap.AuthenticatedState
	c.caps = nil // Capabilities change when user is logged in
	c.locker.Unlock()

	if status.Code == "CAPABILITY" {
		c.gotStatusCaps(status.Arguments)
	}
	return nil
}
229429
func (s *SessionClient) UserLogin(ctx context.Context, email, passphrase string) error {
	// Package up login credentials for the user
	login := apitypes.UserLogin{
		Email:    email,
		Password: passphrase,
	}

	rawLogin, err := json.Marshal(login)
	if err != nil {
		return err
	}

	return performLogin(ctx, s, "user", rawLogin)
}
1355000
func Login(consumerKey string, consumerSecret string, instanceUrl string, username string, password string, apiVersion string) (api *ForceAPI, err error) {

	conn := Connection{
		ConsumerKey:    consumerKey,
		ConsumerSecret: consumerSecret,
		InstanceUrl:    instanceUrl,
		Username:       username,
		Password:       password,
		APIVersion:     apiVersion,
	}

	err = conn.Refresh()

	if err != nil {
		return api, err
	}

	api = &ForceAPI{
		Connection: &conn,
	}

	return api, err
}
1106419
func New(displayNameLen, roleNameLen, usernameLen int) func() (interface{}, error) {
	return func() (interface{}, error) {
		db := new(displayNameLen, roleNameLen, usernameLen)
		// Wrap the plugin with middleware to sanitize errors
		dbType := dbplugin.NewDatabaseErrorSanitizerMiddleware(db, db.SecretValues)

		return dbType, nil
	}
}
771661
func (d *DNSProvider) login() (*response, error) {
	if d.config.AuthSid != "" {
		// already logged in
		return nil, nil
	}

	response, err := d.postRequest("login", url.Values{"api-key": {d.config.APIKey}})
	if err != nil {
		return response, err
	}

	if response == nil {
		return nil, fmt.Errorf("login returned nil response")
	}

	if response.AuthSid == "" {
		return response, fmt.Errorf("login did not return valid Auth-Sid")
	}

	d.config.AuthSid = response.AuthSid

	return response, nil
}
1303228
func Login(id, password string) error {
	// Get the users account
	doc, err := api.GetUser(variables.ServiceDBURL, variables.BackendToken, id)
	if err != nil || doc == nil {
		return errors.New("Could not find username")
	}
	// Comparing the password with the hash
	realPasswordString, ok := (*doc)["password"].(string)
	if ok != true {
		return errors.New("No password for user")
	}
	realPassword := []byte(realPasswordString)
	err = bcrypt.CompareHashAndPassword(realPassword, []byte(password))
	if err != nil {
		return err
	}
	return nil
}
346985
func NewLogRegistry() logging.Registry {
	registry := &logRegistry{
		loggers:      new(sync.Map),
		logLevels:    make(map[string]logrus.Level),
		defaultLevel: initialLogLvl,
	}
	// put default logger
	registry.putLoggerToMapping(defaultLogger)
	return registry
}
763068
func (k *KeybaseServiceBase) LoggedIn(ctx context.Context, name string) error {
	k.log.CDebugf(ctx, "Current session logged in: %s", name)
	// Since we don't have the whole session, just clear the cache and
	// repopulate it.  The `CurrentSession` call executes the "logged
	// in" flow.
	k.setCachedCurrentSession(idutil.SessionInfo{})
	const sessionID = 0
	_, err := k.CurrentSession(ctx, sessionID)
	if err != nil {
		k.log.CDebugf(ctx, "Getting current session failed when %s is logged "+
			"in, so pretending user has logged out: %v",
			name, err)
		if k.config != nil {
			serviceLoggedOut(ctx, k.config)
		}
		return nil
	}

	return nil
}