Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RuneHasSymbol ¶
RuneHasSymbol returns true if the given rune contains a symbol
Types ¶
type PasswordComplexityRulesType ¶
type PasswordComplexityRulesType uint8
PasswordComplexityRulesType x ENUM( PasswordComplexityLowest = 1 // PasswordComplexityLowest There's no rules besides the minimum length PasswordComplexityRequireLetter = 2 // PasswordComplexityRequireLetter At least one letter is required in order to aprove password PasswordComplexityRequireUpperCase = 4 // PasswordComplexityRequireUpperCase At least one uppercase letter is required in order to aprove password. Only works if PasswordComplexityRequireLetter is included/activated PasswordComplexityRequireNumber = 8 // PasswordComplexityRequireNumber At least one number is required in order to aprove password PasswordComplexityRequireSpace = 16 // PasswordComplexityRequireSpace The password must contain at least one space PasswordComplexityRequireSymbol = 32 // PasswordComplexityRequireSymbol User have to include at least one special character, like # or - )
const ( // PasswordComplexityLowest is a PasswordComplexityRulesType of type PasswordComplexityLowest // PasswordComplexityLowest There's no rules besides the minimum length PasswordComplexityLowest PasswordComplexityRulesType = iota + 1 // PasswordComplexityRequireLetter is a PasswordComplexityRulesType of type PasswordComplexityRequireLetter // PasswordComplexityRequireLetter At least one letter is required in order to aprove password PasswordComplexityRequireLetter // PasswordComplexityRequireUpperCase is a PasswordComplexityRulesType of type PasswordComplexityRequireUpperCase // PasswordComplexityRequireUpperCase At least one uppercase letter is required in order to aprove password. Only works if PasswordComplexityRequireLetter is included/activated PasswordComplexityRequireUpperCase PasswordComplexityRulesType = iota + 2 // PasswordComplexityRequireNumber is a PasswordComplexityRulesType of type PasswordComplexityRequireNumber // PasswordComplexityRequireNumber At least one number is required in order to aprove password PasswordComplexityRequireNumber PasswordComplexityRulesType = iota + 5 // PasswordComplexityRequireSpace is a PasswordComplexityRulesType of type PasswordComplexityRequireSpace // PasswordComplexityRequireSpace The password must contain at least one space PasswordComplexityRequireSpace PasswordComplexityRulesType = iota + 12 // PasswordComplexityRequireSymbol is a PasswordComplexityRulesType of type PasswordComplexityRequireSymbol // PasswordComplexityRequireSymbol User have to include at least one special character, like # or - PasswordComplexityRequireSymbol PasswordComplexityRulesType = iota + 27 )
func ParsePasswordComplexityRulesType ¶
func ParsePasswordComplexityRulesType(name string) (PasswordComplexityRulesType, error)
ParsePasswordComplexityRulesType attempts to convert a string to a PasswordComplexityRulesType
func (*PasswordComplexityRulesType) MarshalText ¶
func (x *PasswordComplexityRulesType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method
func (PasswordComplexityRulesType) String ¶
func (x PasswordComplexityRulesType) String() string
String implements the Stringer interface.
func (*PasswordComplexityRulesType) UnmarshalText ¶
func (x *PasswordComplexityRulesType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method
type PasswordResultType ¶
type PasswordResultType uint8
PasswordResultType x ENUM( PasswordResultOK // PasswordResultOK Means the checking ran alright PasswordResultDivergent // PasswordResultDivergent Password is different from confirmation PasswordResultTooShort // PasswordResultTooShort Password is too short PasswordResultTooSimple // PasswordResultTooSimple Given string doesn't satisfy complexity rules )
const ( // PasswordResultOK is a PasswordResultType of type PasswordResultOK // PasswordResultOK Means the checking ran alright PasswordResultOK PasswordResultType = iota // PasswordResultDivergent is a PasswordResultType of type PasswordResultDivergent // PasswordResultDivergent Password is different from confirmation PasswordResultDivergent // PasswordResultTooShort is a PasswordResultType of type PasswordResultTooShort // PasswordResultTooShort Password is too short PasswordResultTooShort // PasswordResultTooSimple is a PasswordResultType of type PasswordResultTooSimple // PasswordResultTooSimple Given string doesn't satisfy complexity rules PasswordResultTooSimple )
func CheckNewPassword ¶
func CheckNewPassword(password, passwordConfirmation string, minimumlength uint, flagComplexity PasswordComplexityRulesType) PasswordResultType
CheckNewPassword Run some basic checks on new password strings, based on given options This routine requires at least 4 (four) characters Example requiring only basic minimum length: CheckNewPassword("lalala", "lalala", 10, CheckNewPasswordComplexityLowest) Example requiring number and symbol: CheckNewPassword("lalala", "lalala", 10, CheckNewPasswordComplexityRequireNumber|CheckNewPasswordComplexityRequireSymbol)
func ParsePasswordResultType ¶
func ParsePasswordResultType(name string) (PasswordResultType, error)
ParsePasswordResultType attempts to convert a string to a PasswordResultType
func (*PasswordResultType) MarshalText ¶
func (x *PasswordResultType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method
func (PasswordResultType) String ¶
func (x PasswordResultType) String() string
String implements the Stringer interface.
func (*PasswordResultType) UnmarshalText ¶
func (x *PasswordResultType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method
type ValidatorI ¶
type ValidatorI interface { CheckURL(str string) *errorAVA.Error CheckEmail(email string) ([]string, *errorAVA.Error) CheckNIF(nif string) ([]string, *errorAVA.Error) CheckName(name string) ([]string, *errorAVA.Error) CheckLocation(location string) ([]string, *errorAVA.Error) CheckCountry(country string) ([]string, *errorAVA.Error) CheckContactPerson(contactPerson string) ([]string, *errorAVA.Error) CheckUsername(username string) ([]string, *errorAVA.Error) CheckPassword(password string) ([]string, *errorAVA.Error) CheckInvoiceNumber(invoiceNumber string) ([]string, *errorAVA.Error) CheckPaymentTerms(paymentTerms int64) ([]string, *errorAVA.Error) CheckPaymentMethod(paymentMethod string) ([]string, *errorAVA.Error) CheckInvoiceAmount(invoiceAmount int64) ([]string, *errorAVA.Error) CheckDate(text string) ([]string, *errorAVA.Error) CheckTime(text string) ([]string, *errorAVA.Error) CheckPhones(text string) ([]string, *errorAVA.Error) CheckPhonesWithExts(text string) ([]string, *errorAVA.Error) CheckLinks(text string) ([]string, *errorAVA.Error) CheckEmails(text string) ([]string, *errorAVA.Error) CheckIPv4s(text string) ([]string, *errorAVA.Error) CheckIPv6s(text string) ([]string, *errorAVA.Error) CheckIPs(text string) ([]string, *errorAVA.Error) CheckNotKnownPorts(text string) ([]string, *errorAVA.Error) CheckPrices(text string) ([]string, *errorAVA.Error) CheckHexColors(text string) ([]string, *errorAVA.Error) CheckCreditCards(text string) ([]string, *errorAVA.Error) CheckBtcAddresses(text string) ([]string, *errorAVA.Error) CheckStreetAddresses(text string) ([]string, *errorAVA.Error) CheckZipCodes(text string) ([]string, *errorAVA.Error) CheckPoBoxes(text string) ([]string, *errorAVA.Error) CheckSSNs(text string) ([]string, *errorAVA.Error) CheckMD5Hexes(text string) ([]string, *errorAVA.Error) CheckSHA1Hexes(text string) ([]string, *errorAVA.Error) CheckSHA256Hexes(text string) ([]string, *errorAVA.Error) CheckGUIDs(text string) ([]string, *errorAVA.Error) CheckISBN13s(text string) ([]string, *errorAVA.Error) CheckISBN10s(text string) ([]string, *errorAVA.Error) CheckVISACreditCards(text string) ([]string, *errorAVA.Error) CheckMasterCardCreditCards(text string) ([]string, *errorAVA.Error) CheckMACAddresses(text string) ([]string, *errorAVA.Error) CheckIBANs(text string) ([]string, *errorAVA.Error) CheckAddressEth(address string) ([]string, *errorAVA.Error) }
func GetInstance ¶
func GetInstance() ValidatorI