Send login QR codes to management room
This commit is contained in:
parent
44e1cf7464
commit
6fca366d6a
2 changed files with 11 additions and 2 deletions
|
@ -83,6 +83,8 @@ func fnLogin(ce *WrappedCommandEvent) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ce.User.hackyLoginCommand = ce
|
||||||
|
ce.User.hackyLoginCommandPrevEvent = ""
|
||||||
_, err := ce.User.Login(context.Background())
|
_, err := ce.User.Login(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ce.User.log.Errorf("Failed to log in:", err)
|
ce.User.log.Errorf("Failed to log in:", err)
|
||||||
|
|
11
user.go
11
user.go
|
@ -69,6 +69,9 @@ type User struct {
|
||||||
spaceMembershipChecked bool
|
spaceMembershipChecked bool
|
||||||
|
|
||||||
DoublePuppetIntent *appservice.IntentAPI
|
DoublePuppetIntent *appservice.IntentAPI
|
||||||
|
|
||||||
|
hackyLoginCommand *WrappedCommandEvent
|
||||||
|
hackyLoginCommandPrevEvent id.EventID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (br *GMBridge) getUserByMXID(userID id.UserID, onlyIfExists bool) *User {
|
func (br *GMBridge) getUserByMXID(userID id.UserID, onlyIfExists bool) *User {
|
||||||
|
@ -524,9 +527,13 @@ func (user *User) sendMarkdownBridgeAlert(formatString string, args ...interface
|
||||||
func (user *User) HandleEvent(event interface{}) {
|
func (user *User) HandleEvent(event interface{}) {
|
||||||
switch v := event.(type) {
|
switch v := event.(type) {
|
||||||
case *events.QR:
|
case *events.QR:
|
||||||
// These should be here
|
// This shouldn't be here
|
||||||
user.zlog.Info().Msg(v.URL)
|
if user.hackyLoginCommand != nil {
|
||||||
|
user.hackyLoginCommandPrevEvent = user.sendQR(user.hackyLoginCommand, v.URL, user.hackyLoginCommandPrevEvent)
|
||||||
|
}
|
||||||
case *events.PairSuccessful:
|
case *events.PairSuccessful:
|
||||||
|
user.hackyLoginCommand = nil
|
||||||
|
user.hackyLoginCommandPrevEvent = ""
|
||||||
user.tryAutomaticDoublePuppeting()
|
user.tryAutomaticDoublePuppeting()
|
||||||
user.Phone = v.PairDeviceData.Mobile.RegistrationID
|
user.Phone = v.PairDeviceData.Mobile.RegistrationID
|
||||||
user.Session.PhoneInfo = v.PairDeviceData.Mobile
|
user.Session.PhoneInfo = v.PairDeviceData.Mobile
|
||||||
|
|
Loading…
Reference in a new issue