Can store login tokens.

This commit is contained in:
Pierre HUBERT
2018-11-29 15:53:54 +01:00
parent 99724f845c
commit 1a3169bc16
13 changed files with 269 additions and 6 deletions

View File

@ -2,6 +2,7 @@
#include "loginwidget.h"
#include "ui_loginwidget.h"
#include "mainwindow.h"
#include "../utils/accountutils.h"
#include "../helpers/accounthelper.h"
@ -25,6 +26,10 @@ void LoginWidget::loginResult(LoginResult result)
if(result == LoginResult::LOGIN_SUCCESS){
qDebug("User successfully signed in.");
//Open the window
MainWindow *mainWindow = new MainWindow();
mainWindow->show();
close();
return;
}
@ -46,6 +51,10 @@ void LoginWidget::loginResult(LoginResult result)
showError(tr("Too many login attempts from your computer. Please try again later..."));
break;
case LoginResult::INVALID_SERVER_RESPONSE:
showError(tr("Could not understand server response!"));
break;
case LoginResult::OTHER_ERROR:
default:
showError(tr("Login attempt did not succeed."));

14
widgets/mainwindow.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}

22
widgets/mainwindow.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

31
widgets/mainwindow.ui Normal file
View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>ComunicMessages</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>