| 87 | """An implementation of IPortal""" |
| 88 | |
| 89 | def login(self_, credentials, mind, *interfaces): # type: ignore[no-untyped-def] # pylint: disable=no-self-argument |
| 90 | if not ( |
| 91 | credentials.username == self.username.encode("utf8") |
| 92 | and credentials.checkPassword(self.password.encode("utf8")) |
| 93 | ): |
| 94 | return fail(ValueError("Invalid credentials")) |
| 95 | |
| 96 | from twisted.conch import manhole |
| 97 | |
| 98 | protocol = telnet.TelnetBootstrapProtocol( |
| 99 | insults.ServerProtocol, manhole.Manhole, self._get_telnet_vars() |
| 100 | ) |
| 101 | return succeed((interfaces[0], protocol, lambda: None)) |
| 102 | |
| 103 | return telnet.TelnetTransport(telnet.AuthenticatingTelnetProtocol, Portal()) |
| 104 | |