Merge pull request #17 from peteretelej/fix/typos

typos: fix minor typos in error messages
This commit is contained in:
Radhi 2018-03-02 16:45:43 +07:00 committed by GitHub
commit 3826d4b7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -80,7 +80,11 @@ var (
return
}
fmt.Println("Accounts has been deleted")
if len(args) == 1 {
fmt.Println("Account has been deleted")
return
}
fmt.Println("Accounts have been deleted")
},
}
)

View File

@ -39,7 +39,7 @@ func exportBookmarks(dstPath string) error {
}
if len(bookmarks) == 0 {
return fmt.Errorf("No saved bookmarks yet")
return fmt.Errorf("No bookmarks saved yet")
}
// Open destination file

View File

@ -32,7 +32,7 @@ var (
if len(args) > 0 {
cError.Println("No matching index found")
} else {
cError.Println("No saved bookmarks yet")
cError.Println("No bookmarks saved yet")
}
os.Exit(1)

View File

@ -35,7 +35,7 @@ var (
jwtKey = make([]byte, 32)
_, err := rand.Read(jwtKey)
if err != nil {
cError.Println("Failed generating key for token")
cError.Println("Failed to generate key for token")
return
}
@ -43,7 +43,7 @@ var (
tplFile, _ := assets.ReadFile("cache.html")
tplCache, err = template.New("cache.html").Parse(string(tplFile))
if err != nil {
cError.Println("Failed generating HTML template")
cError.Println("Failed to generate HTML template")
return
}
@ -161,14 +161,14 @@ func apiLogin(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
// Get account data from database
accounts, err := DB.GetAccounts(request.Username, true)
if err != nil || len(accounts) == 0 {
panic(fmt.Errorf("Account is not exist"))
panic(fmt.Errorf("Account does not exist"))
}
// Compare password with database
account := accounts[0]
err = bcrypt.CompareHashAndPassword([]byte(account.Password), []byte(request.Password))
if err != nil {
panic(fmt.Errorf("Username and password doesn't match"))
panic(fmt.Errorf("Username and password don't match"))
}
// Calculate expiration time
@ -274,7 +274,7 @@ func apiDeleteBookmarks(w http.ResponseWriter, r *http.Request, ps httprouter.Pa
func checkToken(r *http.Request) error {
tokenCookie, err := r.Cookie("token")
if err != nil {
return fmt.Errorf("Token is not exist")
return fmt.Errorf("Token does not exist")
}
token, err := jwt.Parse(tokenCookie.Value, jwtKeyFunc)