Skip to content

Commit 9dcc61d

Browse files
committed
ReviveOverlay: Allow user to logout and delete credentials.
1 parent 3fce332 commit 9dcc61d

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

ReviveOverlay/oculusplatform.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ bool COculusPlatform::Login(const QString& email, const QString& password)
8585
m_PollTimer.start(1000);
8686
return req != 0;
8787
}
88+
89+
void COculusPlatform::Logout()
90+
{
91+
m_PollTimer.stop();
92+
m_strAccessToken.clear();
93+
TokenChanged();
94+
}

ReviveOverlay/oculusplatform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class COculusPlatform : public QObject
5353

5454
bool Init(QString basePath);
5555
bool Login(const QString& email, const QString& password);
56+
void Logout();
5657

5758
bool Connected() { return !m_strAccessToken.isEmpty(); }
5859
QString GetToken() { return m_strAccessToken; }

ReviveOverlay/trayiconcontroller.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ void CTrayIconController::login()
170170

171171
void CTrayIconController::acceptLogin(QString& username, QString& password, int& indexNumber)
172172
{
173+
if (username.isEmpty() || password.isEmpty())
174+
{
175+
COculusPlatform::SharedInstance()->Logout();
176+
WindowsServices::DeleteCredentials();
177+
}
178+
173179
if (COculusPlatform::SharedInstance()->Login(username, password))
174180
WindowsServices::WriteCredentials(username, password);
175181
}

ReviveOverlay/windowsservices.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,8 @@ bool WindowsServices::WriteCredentials(const QString& user, const QString& passw
9595
cred.UserName = (LPWSTR)user.utf16();
9696
return !!CredWriteW(&cred, 0);
9797
}
98+
99+
bool WindowsServices::DeleteCredentials()
100+
{
101+
return !!CredDeleteW(CredTargetName, CRED_TYPE_GENERIC, 0);
102+
}

ReviveOverlay/windowsservices.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class WindowsServices
1010
static bool CopyFiles(QStringList files, QString destination, QStringList newName);
1111
static bool ReadCredentials(QString& user, QString& password);
1212
static bool WriteCredentials(const QString& user, const QString& password);
13+
static bool DeleteCredentials();
1314

1415
private:
1516
static const wchar_t* CredTargetName;

0 commit comments

Comments
 (0)