Ejemplo n.º 1
0
// GetPasswordScore returns a score of 0 (poor), 1, 2, 3 or 4 (excellent) for the strength of the password
func GetPasswordScore(password string, userInput []string) (int, error) {
	if minLength != -1 && len(password) < minLength {
		return 0, errors.New("Password must have at least " + utils.IntToString(minLength) + " characters!")
	}
	if maxLength != -1 && len(password) > maxLength {
		return 0, errors.New("Password must be not longer than " + utils.IntToString(maxLength) + " characters!")
	}
	match := DeterminePasswordStrength(password, userInput)
	return match.Score, nil
}
Ejemplo n.º 2
0
//------------------------------------------------------------------
// ~ CONSTRUCTORS
//------------------------------------------------------------------
func NewSmurfProcessor() *queue.DefaultProcessor {
	name := "SmurfProcessor " + utils.IntToString(processorIdSmurf)
	processorIdSmurf++
	proc := queue.NewDefaultProcessor(name)
	proc.ProcessingFunc = processingFunc
	proc.GetDataWrapper = newOrder
	proc.Persistor = order.GetOrderPersistor()

	return proc
}