Commit e6b8e52d authored by Loïck Bonniot's avatar Loïck Bonniot
Browse files

[c] Fix cross-compilation for register command

parent 66c4467d
Pipeline #347 passed with stage
......@@ -7,6 +7,8 @@ stages:
Unit tests:
stage: test
except:
- /^[0-9]+\./
tags:
- golang
- mongo # Require an available mongo service
......@@ -40,6 +42,8 @@ Unit tests:
Integration tests:
stage: test
except:
- /^[0-9]+\./
tags:
- golang
- mongo
......@@ -53,6 +57,8 @@ Integration tests:
Code lint:
stage: test
except:
- /^[0-9]+\./
allow_failure: True
tags:
- golang
......
......@@ -8,7 +8,6 @@ import (
osuser "os/user"
"strconv"
"strings"
"time"
"dfss/dfssc/user"
"golang.org/x/crypto/ssh/terminal"
......@@ -20,17 +19,17 @@ func registerUser() {
var country, mail, organization, unit, passphrase string
var bits int
name := "Jon Doe"
u, err := osuser.Current()
if err != nil {
fmt.Println("An error occurred : ", err.Error())
return
if err == nil {
name = u.Name
}
// Get all the necessary parameters
readStringParam("Mail", "", &mail)
readStringParam("Country", time.Now().Location().String(), &country)
readStringParam("Organization", u.Name, &organization)
readStringParam("Organizational unit", u.Name, &unit)
readStringParam("Country", "FR", &country)
readStringParam("Organization", name, &organization)
readStringParam("Organizational unit", name, &unit)
readIntParam("Length of the key (2048 or 4096)", "2048", &bits)
err = readPassword(&passphrase, true)
if err != nil {
......
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