forked from Mirrors/gomuks
Prepare for mainview
This commit is contained in:
parent
e5cdd95733
commit
b7d9a914e1
1 changed files with 13 additions and 9 deletions
|
@ -103,6 +103,18 @@ func (view *LoginView) Error(err string) {
|
||||||
|
|
||||||
view.parent.App.Redraw()
|
view.parent.App.Redraw()
|
||||||
}
|
}
|
||||||
|
func (view *LoginView) actuallyLogin(ctx context.Context, hs, mxid, password string) {
|
||||||
|
view.loading = true
|
||||||
|
view.loginButton.SetText("Logging in...")
|
||||||
|
err := view.parent.Client.LoginPassword(ctx, hs, mxid, password)
|
||||||
|
if err == nil {
|
||||||
|
view.loginButton.SetText("it woked")
|
||||||
|
} else {
|
||||||
|
view.Error(err.Error())
|
||||||
|
}
|
||||||
|
view.loading = false
|
||||||
|
view.loginButton.SetText("Login")
|
||||||
|
}
|
||||||
|
|
||||||
func (view *LoginView) Login() {
|
func (view *LoginView) Login() {
|
||||||
if view.loading {
|
if view.loading {
|
||||||
|
@ -112,13 +124,5 @@ func (view *LoginView) Login() {
|
||||||
mxid := view.id.GetText()
|
mxid := view.id.GetText()
|
||||||
password := view.password.GetText()
|
password := view.password.GetText()
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
go view.actuallyLogin(ctx, hs, mxid, password)
|
||||||
view.loading = true
|
|
||||||
view.loginButton.SetText("Logging in...")
|
|
||||||
err := view.parent.Client.LoginPassword(ctx, hs, mxid, password)
|
|
||||||
if err == nil {
|
|
||||||
view.loginButton.SetText("it woked")
|
|
||||||
} else {
|
|
||||||
view.Error(err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue