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