Store token after first login to keyring (#5)
This commit is contained in:
parent
aaf881bf06
commit
760b29fa29
2 changed files with 3 additions and 14 deletions
15
discordo.go
15
discordo.go
|
|
@ -35,16 +35,8 @@ func main() {
|
|||
mainFlex = ui.NewMainFlex(guildsDropDown, channelsList, messagesTextView)
|
||||
app = ui.NewApplication(onApplicationInputCapture)
|
||||
|
||||
email := util.GetPassword("email")
|
||||
password := util.GetPassword("password")
|
||||
token := util.GetPassword("token")
|
||||
if email != "" && password != "" {
|
||||
app.
|
||||
SetRoot(mainFlex, true).
|
||||
SetFocus(guildsDropDown)
|
||||
|
||||
discordSession = newSession(email, password, "")
|
||||
} else if token != "" {
|
||||
if token != "" {
|
||||
app.
|
||||
SetRoot(mainFlex, true).
|
||||
SetFocus(guildsDropDown)
|
||||
|
|
@ -215,9 +207,7 @@ func onLoginFormLoginButtonSelected() {
|
|||
}
|
||||
|
||||
discordSession = newSession(email, password, "")
|
||||
|
||||
util.SetPassword("email", email)
|
||||
util.SetPassword("password", password)
|
||||
util.SetPassword("token", discordSession.Token)
|
||||
} else if loginVia == "token" {
|
||||
token := loginForm.GetFormItemByLabel("Token").(*tview.InputField).GetText()
|
||||
if token == "" {
|
||||
|
|
@ -225,7 +215,6 @@ func onLoginFormLoginButtonSelected() {
|
|||
}
|
||||
|
||||
discordSession = newSession("", "", token)
|
||||
|
||||
util.SetPassword("token", token)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func NewLoginForm(via string, onLoginFormLoginButtonSelected func(), onLoginForm
|
|||
SetButtonBackgroundColor(loginFormButtonBackgroundColor).
|
||||
SetBackgroundColor(loginFormBackgroundColor).
|
||||
SetBorder(true).
|
||||
SetBorderPadding(15, 15, 15, 15)
|
||||
SetBorderPadding(0, 0, 1, 1)
|
||||
|
||||
if via == "token" {
|
||||
loginForm.AddPasswordField("Token", "", 0, 0, nil)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue