summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport
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)
commitebb3f5828c9ac684f18135b17152d714939578f8 (patch)
tree76a1b3e7c23058db5ec7895fb0ad8b454dc0bbb4 /src/helsinki.at/rhimport
parentef640c5a4b1dbd52ff2b125cb9abd33a2d562b62 (diff)
further improved simple web interface
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r--src/helsinki.at/rhimport/importer.go19
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
}