Commit dcf7cf25 authored by Richer Maximilien's avatar Richer Maximilien

[c][p] Fix review comments

parent f5a5f874
Pipeline #2279 passed with stage
......@@ -25,13 +25,13 @@ var unregisterCmd = &cobra.Command{
var ready string
readStringParam("Do you REALLY want to delete "+cert.Subject.CommonName+"? Type 'yes' to confirm", "", &ready)
if ready != "yes" {
fmt.Println("Unregistering aborted!")
fmt.Fprintln(os.Stderr, "Unregistering aborted!")
os.Exit(1)
}
err = user.Unregister()
if err != nil {
fmt.Fprintln(os.Stderr, "Error: cannot unregister:", err.Error())
fmt.Fprintln(os.Stderr, "Cannot unregister:", err.Error())
os.Exit(2)
}
},
......
......@@ -9,7 +9,7 @@ import (
// Unregister delete a user based on the provided certificate hash
func Unregister(manager *mgdb.MongoManager, userCertificateHash []byte) *api.ErrorCode {
count, err := manager.Get("users").DeleteAll(bson.M{
"certHash": bson.M{"$eq": userCertificateHash},
"certHash": userCertificateHash,
})
if err != nil || count == 0 {
return &api.ErrorCode{Code: api.ErrorCode_INVARG, Message: "No user matching provided certificate"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment