コード例 #1
0
ファイル: password_strength.go プロジェクト: foomo/shop
// 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
}
コード例 #2
0
ファイル: example_smurfs.go プロジェクト: foomo/shop
//------------------------------------------------------------------
// ~ 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
}