1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-24 22:15:33 +00:00

If your auth data is invalid or missing, you will be prompted to re-login to telegram.

This commit is contained in:
Fabian Schlenz 2016-07-26 05:49:20 +02:00
parent 7b28f8b7d0
commit 8a266dedfe

View File

@ -117,6 +117,11 @@ public class CommandLineController {
try {
logger.info("Creating UserManager");
user = new UserManager(client);
if (!CommandLineOptions.cmd_login && user.getUser()==null) {
System.out.println("Your authorization data is invalid or missing. You will have to login with Telegram again.");
CommandLineOptions.cmd_login = true;
}
logger.debug("CommandLineOptions.val_export: {}", CommandLineOptions.val_export);
if (CommandLineOptions.val_export != null) {
@ -133,7 +138,7 @@ public class CommandLineController {
logger.debug("CommandLineOptions.cmd_login: {}", CommandLineOptions.cmd_login);
if (CommandLineOptions.cmd_login) {
cmd_login();
cmd_login(account);
System.exit(0);
}
@ -160,10 +165,12 @@ public class CommandLineController {
}
}
private void cmd_login() throws RpcErrorException, IOException {
System.out.println("Please enter your phone number in international format.");
System.out.println("Example: +4917077651234");
String phone = getLine();
private void cmd_login(String phone) throws RpcErrorException, IOException {
if (phone==null) {
System.out.println("Please enter your phone number in international format.");
System.out.println("Example: +4917077651234");
phone = getLine();
}
user.sendCodeToPhoneNumber(phone);
System.out.println("Telegram sent you a code. Please enter it here.");