feat: improve login flow

This commit is contained in:
James Houlahan
2020-04-02 16:41:49 +02:00
parent 941e09079c
commit 6e38a65bd8
41 changed files with 595 additions and 362 deletions

View File

@ -18,7 +18,9 @@
package liveapi
import (
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
"fmt"
"os"
"github.com/cucumber/godog"
"github.com/pkg/errors"
)
@ -28,7 +30,11 @@ func (cntrl *Controller) AddUser(user *pmapi.User, addresses *pmapi.AddressList,
return godog.ErrPending
}
client := cntrl.GetClient(user.ID)
client := pmapi.NewClient(&pmapi.ClientConfig{
AppVersion: fmt.Sprintf("Bridge_%s", os.Getenv("VERSION")),
ClientID: "bridge-cntrl",
TokenManager: pmapi.NewTokenManager(),
}, user.ID)
authInfo, err := client.AuthInfo(user.Name)
if err != nil {
@ -55,6 +61,5 @@ func (cntrl *Controller) AddUser(user *pmapi.User, addresses *pmapi.AddressList,
}
cntrl.pmapiByUsername[user.Name] = client
return nil
}