1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +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

@ -118,6 +118,11 @@ public class CommandLineController {
logger.info("Creating UserManager"); logger.info("Creating UserManager");
user = new UserManager(client); 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); logger.debug("CommandLineOptions.val_export: {}", CommandLineOptions.val_export);
if (CommandLineOptions.val_export != null) { if (CommandLineOptions.val_export != null) {
if (CommandLineOptions.val_export.toLowerCase().equals("html")) { if (CommandLineOptions.val_export.toLowerCase().equals("html")) {
@ -133,7 +138,7 @@ public class CommandLineController {
logger.debug("CommandLineOptions.cmd_login: {}", CommandLineOptions.cmd_login); logger.debug("CommandLineOptions.cmd_login: {}", CommandLineOptions.cmd_login);
if (CommandLineOptions.cmd_login) { if (CommandLineOptions.cmd_login) {
cmd_login(); cmd_login(account);
System.exit(0); System.exit(0);
} }
@ -160,10 +165,12 @@ public class CommandLineController {
} }
} }
private void cmd_login() throws RpcErrorException, IOException { private void cmd_login(String phone) throws RpcErrorException, IOException {
System.out.println("Please enter your phone number in international format."); if (phone==null) {
System.out.println("Example: +4917077651234"); System.out.println("Please enter your phone number in international format.");
String phone = getLine(); System.out.println("Example: +4917077651234");
phone = getLine();
}
user.sendCodeToPhoneNumber(phone); user.sendCodeToPhoneNumber(phone);
System.out.println("Telegram sent you a code. Please enter it here."); System.out.println("Telegram sent you a code. Please enter it here.");