feat: finished create task
This commit is contained in:
27
main.go
27
main.go
@@ -1,24 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"create/password"
|
||||
"create/web"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Info("Welcome to Password Checker")
|
||||
var input string // Users inputted password
|
||||
|
||||
fmt.Println("Welcome to Password Checker")
|
||||
|
||||
// Fetch common words
|
||||
commonWords, err := web.FetchCommonWords()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Printf("ERROR: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Fetch common passwords
|
||||
commonPasswords, err := web.FetchCommonPasswords()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
fmt.Printf("ERROR: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Fetch user input
|
||||
fmt.Print("Enter your password: ")
|
||||
fmt.Scanf("%s", &input)
|
||||
|
||||
// Check users password
|
||||
message, err := password.Check(input, commonWords, commonPasswords)
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println(message)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user