// SetPassword checks and updates user's password.
// First return value determines whether the password was set or not.
SetPassword checks and updates user's password.
First return value determines whether the password was set or not.
// SetPassword checks and updates user ' s password . // First return value determines whether the password was set or not .
func (c *Core) SetPassword(p string) (bool, error) {
	if p == "" {
		if c.PasswordHash == nil {
			return false, ErrInvalidPassword
		}
		return false, nil
	}
	if err := CheckPassword(p); err != nil {
		return false, err
	}
	h, err := bcrypt.GenerateFromPassword([]byte(p), bcrypt.DefaultCost)
	if err != nil {
		return false, err
	}
	c.PasswordHash = h
	return true, nil
}
func ( c * Core ) SetPassword ( p string ) ( bool , error ) { if p == " " { if c . PasswordHash == nil { return false , ErrInvalidPassword } return false , nil } if err := CheckPassword ( p ) ; err != nil { return false , err } h , err := bcrypt . GenerateFromPassword ( [ ] byte ( p ) , bcrypt . DefaultCost ) if err != nil { return false , err } c . PasswordHash = h return true , nil }
SetPassword checks and updates user's password.
SetPassword checks and updates user ' s password .
// unlikely to happen