mirror of
https://gitlab.com/comunic/comunicmessages
synced 2024-12-04 11:14:09 +00:00
Can logout from account.
This commit is contained in:
parent
56c1e4a88b
commit
2396047204
@ -16,6 +16,12 @@ bool AccountHelper::signedIn()
|
||||
return ConfigurationHelper().getAccountTokens().isValid();
|
||||
}
|
||||
|
||||
void AccountHelper::logout()
|
||||
{
|
||||
//Destroy login tokens
|
||||
ConfigurationHelper().setAccountTokens(AccountLoginTokens());
|
||||
}
|
||||
|
||||
void AccountHelper::login(const AccountLoginRequest &info)
|
||||
{
|
||||
//Create API request
|
||||
|
@ -27,6 +27,11 @@ public:
|
||||
*/
|
||||
bool signedIn();
|
||||
|
||||
/**
|
||||
* Logout user
|
||||
*/
|
||||
void logout();
|
||||
|
||||
/**
|
||||
* Perform login
|
||||
*
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "aboutthisappdialog.h"
|
||||
#include "loginwidget.h"
|
||||
|
||||
#include "../helpers/accounthelper.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@ -23,3 +28,17 @@ void MainWindow::on_actionAbout_this_App_triggered()
|
||||
{
|
||||
AboutThisAppDialog(this).exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionLogout_triggered()
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Sign out"), tr("Do you really want to sign out from your account?")) != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
AccountHelper().logout();
|
||||
|
||||
//Display login widget
|
||||
(new LoginWidget())->show();
|
||||
|
||||
//Close this widget
|
||||
close();
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ private slots:
|
||||
|
||||
void on_actionAbout_this_App_triggered();
|
||||
|
||||
void on_actionLogout_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
@ -27,6 +27,7 @@
|
||||
<property name="title">
|
||||
<string>Account</string>
|
||||
</property>
|
||||
<addaction name="actionLogout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
@ -49,6 +50,11 @@
|
||||
<string>About this App</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLogout">
|
||||
<property name="text">
|
||||
<string>Logout</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
Reference in New Issue
Block a user