summaryrefslogtreecommitdiff
path: root/importer.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-04 04:46:53 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-04 04:46:53 (GMT)
commit58f54da16b88f2600c9d53b49ae81e14facd293c (patch)
tree9f3bb672c8bda8e2caa27b6b2ef73e9d603c3297 /importer.go
parent8d71a7cf19dc3e36c0d9ac5a789ae647896859af (diff)
further improved simple web interface
Diffstat (limited to 'importer.go')
-rw-r--r--importer.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/importer.go b/importer.go
index 8c7e66e..e47bc05 100644
--- a/importer.go
+++ b/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
}