diff options
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 8c7e66e..e47bc05 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -26,7 +26,7 @@ package rhimport import ( // "bytes" - "fmt" + // "fmt" // "io" // "mime/multipart" // "net/http" @@ -36,7 +36,8 @@ import ( type ImportContext struct { Conf *Config UserName string - password string + Password string + Trusted bool GroupName string Cart int Channels int @@ -51,6 +52,8 @@ func NewImportContext(conf *Config, user string, group string, cart int) *Import ctx := new(ImportContext) ctx.Conf = conf ctx.UserName = user + ctx.Password = "" + ctx.Trusted = false ctx.GroupName = group ctx.Cart = cart ctx.Channels = 2 @@ -75,7 +78,7 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) { err = res.err return } - ctx.password = res.password + ctx.Password = res.password return } @@ -129,12 +132,14 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) { func ImportFile(ctx *ImportContext) (err error) { rhl.Println("ImportFile called for", ctx.SourceFile) - if err = ctx.getPassword(true); err != nil { - return + if ctx.Trusted { + if err = ctx.getPassword(true); err != nil { + return + } } - rhdl.Println("credentials:", ctx.UserName, "/", ctx.password) + rhdl.Printf("credentials: '%s':'%s'", ctx.UserName, ctx.Password) - err = fmt.Errorf("%+v", ctx) +// err = fmt.Errorf("%+v", ctx) return } |