Permalink
Browse files

Fall back to regular login when autologin fails

Fixes #316
  • Loading branch information...
1 parent 851356f commit 72139f700efc7e7a54c7d7e061f7df157fc39fbf @jleclanche jleclanche committed Nov 5, 2015
Showing with 26 additions and 17 deletions.
  1. +25 −17 src/daemon/Display.cpp
  2. +1 −0 src/daemon/Display.h
View
@@ -103,6 +103,29 @@ namespace SDDM {
m_displayServer->start();
}
+ bool Display::attemptAutologin() {
+ Session::Type sessionType = Session::X11Session;
+
+ // determine session type
+ const QString &autologinSession = mainConfig.Autologin.Session.get();
+ if (findSessionEntry(mainConfig.XDisplay.SessionDir.get(), autologinSession)) {
+ sessionType = Session::X11Session;
+ } else if (findSessionEntry(mainConfig.WaylandDisplay.SessionDir.get(), autologinSession)) {
+ sessionType = Session::WaylandSession;
+ } else {
+ qCritical() << "Unable to find autologin session entry" << autologinSession;
+ return false;
+ }
+
+ Session session;
+ session.setTo(sessionType, autologinSession);
+
+ m_auth->setAutologin(true);
+ startAuth(mainConfig.Autologin.User.get(), QString(), session);
+
+ return true;
+ }
+
void Display::displayServerStarted() {
// check flag
if (m_started)
@@ -122,25 +145,10 @@ namespace SDDM {
// set flags
m_started = true;
- // determine session type
- const QString &autologinSession = mainConfig.Autologin.Session.get();
- Session session;
- if (findSessionEntry(mainConfig.XDisplay.SessionDir.get(), autologinSession)) {
- session.setTo(Session::X11Session, autologinSession);
- } else if (findSessionEntry(mainConfig.WaylandDisplay.SessionDir.get(), autologinSession)) {
- session.setTo(Session::WaylandSession, autologinSession);
- } else {
- qCritical() << "Unable to find autologin session entry" << autologinSession;
- emit loginFailed(m_socket);
+ bool success = attemptAutologin();
+ if (success) {
return;
}
-
- // start session
- m_auth->setAutologin(true);
- startAuth(mainConfig.Autologin.User.get(), QString(), session);
-
- // return
- return;
}
// start socket server
View
@@ -60,6 +60,7 @@ namespace SDDM {
void login(QLocalSocket *socket,
const QString &user, const QString &password,
const Session &session);
+ bool attemptAutologin();
void displayServerStarted();
signals:

0 comments on commit 72139f7

Please sign in to comment.