// Generates a new password for the user with a new salt. func newPassword(password string) Password { salt := utils.RandomString(64) return Password{ hash: generatePassword(password, salt), salt: salt, } }
// Give the user a new (temporary) password and send it to them through an // email. func (s UserService) Recover(email string) *utils.GoAuthError { user, err := s.repository.findByEmail(email) if err != nil { return err } user.setPassword(utils.RandomString(8)) err = s.repository.saveUser(user) if err != nil { return err } // @TODO: send mail to the user. return err }
// A helper function to generate the verification tokens. func generateNewToken() string { return utils.RandomString(16) }
// A helper function which actually does the generating of an ID. func generateNewID() string { return utils.RandomString(15) }