diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-02-18 21:31:28 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-02-18 21:31:28 +0200 |
commit | 2610c2bf9f220e188e4cf8f4b9bcf88bde541958 (patch) | |
tree | 9777b465a150d61c09669aef015f816f99236df3 /ui | |
parent | 18fa85f4c42fc23f4e35dc029cf59232adead404 (diff) |
Update readme a bit and add SSO support
Diffstat (limited to 'ui')
-rw-r--r-- | ui/view-login.go | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/view-login.go b/ui/view-login.go index a65a77c..023aaad 100644 --- a/ui/view-login.go +++ b/ui/view-login.go @@ -44,6 +44,8 @@ type LoginView struct { loginButton *mauview.Button quitButton *mauview.Button + loading bool + matrix ifc.MatrixContainer config *config.Config parent *GomuksUI @@ -112,11 +114,7 @@ func (view *LoginView) Error(err string) { view.parent.Render() } -func (view *LoginView) Login() { - hs := view.homeserver.GetText() - mxid := view.username.GetText() - password := view.password.GetText() - +func (view *LoginView) actuallyLogin(hs, mxid, password string) { debug.Printf("Logging into %s as %s...", hs, mxid) view.config.HS = hs err := view.matrix.InitClient() @@ -130,8 +128,23 @@ func (view *LoginView) Login() { view.Error(httpErr.Message) } } else { - view.Error("Failed to connect to server.") + view.Error(err.Error()) } debug.Print("Login error:", err) } + view.loading = false + view.loginButton.SetText("Login") +} + +func (view *LoginView) Login() { + if view.loading { + return + } + hs := view.homeserver.GetText() + mxid := view.username.GetText() + password := view.password.GetText() + + view.loading = true + view.loginButton.SetText("Logging in...") + go view.actuallyLogin(hs, mxid, password) } |