From feeee290072bcd3897838e1696fd278cdfc60202 Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Thu, 7 May 2020 19:31:45 -0700 Subject: [PATCH] Fix final issues --- cmd/root.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index cb80f94d2..3afbfac13 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -114,7 +114,6 @@ func sessionInitialization() (*id.User, string, *api.Client) { } globals.Log.INFO.Println("Initialized Ram Storage") register = true - } else { var sessionA, sessionB string @@ -430,11 +429,14 @@ var rootCmd = &cobra.Command{ } globals.Log.INFO.Println("Logged In!") globals.Log.INFO.Printf("session prior to udb reg: %v", client.GetSession()) - if username != "" && !utils.FileExists(sessionFile) { - err := client.RegisterWithUDB(username, 2*time.Minute) - if err != nil { - globals.Log.ERROR.Printf("%+v", err) - } + + // todo: since this is in the root cmd, would checking the regstate directly really be bad? + // It's correct that it should be an error state for RegisterWithUDB, however for this, it's start up code + if username != "" && client.GetSession().GetRegState() == user.PermissioningComplete { + err := client.RegisterWithUDB(username, 2*time.Minute) + if err != nil { + globals.Log.ERROR.Printf("%+v", err) + } } cryptoType := parse.Unencrypted -- GitLab