mirror of
https://gitlab.com/comunic/comunicterm
synced 2024-11-16 10:31:06 +00:00
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include <iostream>
|
|
|
|
#include <helpers/accounthelper.h>
|
|
|
|
#include "api_request.h"
|
|
#include "loginscreen.h"
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
cout << "Comunic Term (c) Pierre HUBERT" << endl;
|
|
|
|
bool onlyGetTokens = false;
|
|
|
|
if(argc > 1) {
|
|
string arg = argv[1];
|
|
|
|
// Show help
|
|
if(arg == "help") {
|
|
cout << "Usage: " << endl;
|
|
cout << "* help : Show this help" << endl;
|
|
cout << "* getTokens : Get login token ONLY" << endl;
|
|
return 0;
|
|
}
|
|
|
|
// Get login tokens
|
|
if(arg == "getTokens") {
|
|
cout << "Getting only login tokens..." << endl;
|
|
onlyGetTokens = true;
|
|
}
|
|
|
|
}
|
|
|
|
// First, we need to sign in user
|
|
if(!LoginScreen().exec(!onlyGetTokens)) {
|
|
cerr << "Could not sign in user!" << endl;
|
|
return -1;
|
|
}
|
|
|
|
if(onlyGetTokens) {
|
|
const auto tokens = AccountHelper::loginTokens();
|
|
cout << "Token 1: " << tokens[0] << endl;
|
|
cout << "Token 2: " << tokens[1] << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|