Commit 9b42fc4c authored by Richer Maximilien's avatar Richer Maximilien

Merge branch '295_fix_windows_passwd' into 'master'

[c] Fix password question on non-unix terminals



See merge request !30
parents c17cfe72 864c2dac
Pipeline #309 failed with stage
......@@ -71,7 +71,7 @@ Code lint:
- "./build/deps.sh"
- "cd $GOPATH/src/dfss && go install ./..."
- "gometalinter --install"
- "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures ./..."
- "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures --disable=aligncheck ./..."
Deploy:
stage: deploy
......
......@@ -80,6 +80,15 @@ func readIntParam(message, def string, ptr *int) {
// Get the password from standard input
func readPassword(ptr *string, needConfirm bool) error {
if !terminal.IsTerminal(0) {
fmt.Println("+------------------------- WARNING --------------------------+")
fmt.Println("| This is not a UNIX terminal, your password will be visible |")
fmt.Println("+------------------------- WARNING --------------------------+")
readStringParam("Enter your passphrase", "", ptr)
return nil
}
oldState, err := terminal.MakeRaw(0)
if err != nil {
return err
......
......@@ -29,7 +29,7 @@ type TTPJSON struct {
// JSON is the structure used to store contract information in JSON format
type JSON struct {
UUID string
Date time.Time
Date *time.Time
Comment string
File *FileJSON
Signers []SignerJSON
......@@ -42,7 +42,7 @@ func GetJSON(c *entities.Contract, ttp *TTPJSON) ([]byte, error) {
data := JSON{
UUID: c.ID.Hex(),
Date: c.Date,
Date: &c.Date,
Comment: c.Comment,
File: &FileJSON{
Name: c.File.Name,
......
......@@ -77,8 +77,8 @@ func (r *ContractRepository) GetWaitingForUser(email string) ([]Contract, error)
"ready": false,
"signers": bson.M{
"$elemMatch": bson.M{
"email" : email,
"hash" : "",
"email": email,
"hash": "",
}},
}, &res)
return res, err
......
......@@ -244,7 +244,7 @@ func launchMissedContracts(manager *mgdb.MongoManager, user *entities.User) {
repository := entities.NewContractRepository(manager.Get("contracts"))
contracts, err := repository.GetWaitingForUser(user.Email)
if err != nil {
log.Println("Cannot get missed contracts for user", user.Email + ":", err)
log.Println("Cannot get missed contracts for user", user.Email+":", err)
}
for _, c := range contracts {
......@@ -263,7 +263,7 @@ func launchMissedContracts(manager *mgdb.MongoManager, user *entities.User) {
// Update contract in database
_, err = repository.Collection.UpdateByID(c)
if err != nil {
log.Println("Cannot update missed contract", c.ID, "for user", user.Email + ":", err)
log.Println("Cannot update missed contract", c.ID, "for user", user.Email+":", err)
}
if c.Ready {
......
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