Code Monkey home page Code Monkey logo

pwd-verify's Introduction

Password Validator

It is an example to verify password format by given configuration

About Validator return parameters

Since you New a Password.Service, you need set follows configuration to tell what kind of rule set you want:
(uint8)
minLength: the short password request maxLength: the maximum password length be accepted (bool)
requireUppercase: Do you require at least one uppercase character in password?
requireLowercase: Do you require at least one lowercase character in password?
requireNumber: Do you require at least one number character in password?
allowSequence: Do you allowed sequence characters in password?
requireSymbol: Do you require at least one special symbol in password?

And while password be varified by Password.Validtor it will return multiple values length, uppercase, lowercase, number, symbol, sequence in bool type, err in error type).

If err return is not nil, which mean password does not meets the configuration.
Others parameters can help to tell you which rules been violation.

Want to apply password validator module in your project

If you want applied this password validator in your project. You can use go mod to manage and get password validator module into your project

go get github.com/hsuanshao/pwd-verify/module/password

The you can import it in your project.

import (
    "github.com/hsuanshao/pwd-verify/module/password"
)

Dependency Injection

There are many dependency injection solition in Go. But I choose to do another example to implement dependency inejction solution by myself in this programming task. Which is placed in /app/infra/di.

parameters configuration can be set by flags

Other famous dependency injection solution:

Wire
Uber-Dig
sarulabs-di this almost similar to uber dig, but without use reflect, therefor, all deps must have unique name.

note: reflect affect performance.

You can get the example to get Password.Service by dependency injection in app/main.go

Run test

It is simple to run test, all you need to do is in root path of this project and type make test

pwd-verify's People

Contributors

hsuanshao avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.