-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
113 lines (100 loc) · 3.12 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package main
import (
"authspire/authspire"
"bufio"
"fmt"
"os"
"strings"
)
var name = ""
var userid = ""
var secret = ""
var currentVersion = "1.0"
var publicKey = ""
func logo() {
logo := `
Yb dP db
YbdP .d8b. 8 8 8d8b dPYb 88b. 88b.
YP 8' .8 8b d8 8P dPwwYb 8 8 8 8
88 ` + "`" + `Y8P' ` + "`" + `Y8P8 8 dP Yb 88P' 88P'
8 8
`
fmt.Print(logo)
}
func main() {
authspire.API(name, userid, secret, currentVersion, publicKey) // IMPORTANT FOR API TO WORK
authspire.InitApp() // Step 1. Initialize your application
logo()
fmt.Println("[1] Register")
fmt.Println("[2] Login")
fmt.Println("[3] License only")
fmt.Println("[4] Add Log")
fmt.Print(">> ")
reader := bufio.NewReader(os.Stdin)
option, _ := reader.ReadString('\n')
option = strings.TrimSpace(option)
fmt.Println()
if option == "1" {
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.TrimSpace(username)
fmt.Print("Password: ")
password, _ := reader.ReadString('\n')
password = strings.TrimSpace(password)
fmt.Print("License: ")
license, _ := reader.ReadString('\n')
license = strings.TrimSpace(license)
fmt.Print("Email: ")
email, _ := reader.ReadString('\n')
email = strings.TrimSpace(email)
registered := authspire.Register(username, password, license, email)
if registered {
fmt.Println("Thanks for registering!")
}
} else if option == "2" {
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.TrimSpace(username)
fmt.Print("Password: ")
password, _ := reader.ReadString('\n')
password = strings.TrimSpace(password)
loggedIn := authspire.Login(username, password)
if loggedIn {
fmt.Println("Welcome back " + authspire.User.Username)
fmt.Println()
fmt.Println(authspire.User.Email)
fmt.Println(authspire.User.IP)
fmt.Println(authspire.User.Expires)
fmt.Println(authspire.User.HWID)
fmt.Println(authspire.User.Last_Login)
fmt.Println(authspire.User.Created_At)
fmt.Println(authspire.User.Variable)
fmt.Println(authspire.User.Level)
}
} else if option == "3" {
fmt.Print("License: ")
license, _ := reader.ReadString('\n')
license = strings.TrimSpace(license)
if authspire.License(license) {
fmt.Println("Welcome back " + authspire.User.Username)
fmt.Println()
fmt.Println(authspire.User.Email)
fmt.Println(authspire.User.IP)
fmt.Println(authspire.User.Expires)
fmt.Println(authspire.User.HWID)
fmt.Println(authspire.User.Last_Login)
fmt.Println(authspire.User.Created_At)
fmt.Println(authspire.User.Variable)
fmt.Println(authspire.User.Level)
}
} else if option == "4" {
fmt.Print("Username: ")
username, _ := reader.ReadString('\n')
username = strings.TrimSpace(username)
fmt.Print("Action: ")
action, _ := reader.ReadString('\n')
action = strings.TrimSpace(action)
authspire.AddLog(username, action)
fmt.Println("Log added!")
}
}