Lazy console login
This commit is contained in:
parent
8949e35bf9
commit
c6a8af0c44
@ -21,6 +21,10 @@ final class ConsoleInteractiveAuthenticationData implements AuthenticationData {
|
||||
initializeIfNeeded();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBot() {
|
||||
initializeIfNeeded();
|
||||
|
@ -15,7 +15,15 @@ final class ScannerClientInteraction implements ClientInteraction {
|
||||
public String onParameterRequest(InputParameter parameter, ParameterInfo parameterInfo) {
|
||||
AuthenticationData authenticationData = authenticable.getAuthenticationData();
|
||||
String who;
|
||||
if (authenticationData.isBot()) {
|
||||
boolean useRealWho;
|
||||
if (authenticationData instanceof ConsoleInteractiveAuthenticationData) {
|
||||
useRealWho = ((ConsoleInteractiveAuthenticationData) authenticationData).isInitialized();
|
||||
} else {
|
||||
useRealWho = true;
|
||||
}
|
||||
if (!useRealWho) {
|
||||
who = "login";
|
||||
} else if (authenticationData.isBot()) {
|
||||
who = authenticationData.getBotToken().split(":", 2)[0];
|
||||
} else {
|
||||
who = "+" + authenticationData.getUserPhoneNumber();
|
||||
|
Loading…
Reference in New Issue
Block a user