Make the remember-me feature make again
This commit is contained in:
+7
-4
@@ -58,11 +58,14 @@ Auth::Auth()
|
|||||||
this->setHidden(true);
|
this->setHidden(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Wt::Auth::User user = _model->processAuthToken();
|
|
||||||
// if (user.isValid())
|
|
||||||
// _model->loginUser(LmsApp->getDb().getLogin(), user, Wt::Auth::LoginState::Weak);
|
|
||||||
|
|
||||||
updateView(_model.get());
|
updateView(_model.get());
|
||||||
|
|
||||||
|
Wt::Auth::User user = _model->processAuthToken();
|
||||||
|
if (user.isValid())
|
||||||
|
{
|
||||||
|
LMS_LOG(UI, DEBUG) << "Valid user found from auth token (id = " << user.id() << ")";
|
||||||
|
_model->loginUser(LmsApp->getDb().getLogin(), user, Wt::Auth::LoginState::Weak);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnecti
|
|||||||
firstConnection = (Database::User::getAll(LmsApp->getDboSession()).size() == 0);
|
firstConnection = (Database::User::getAll(LmsApp->getDboSession()).size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LMS_LOG(UI, DEBUG) << "Creating root widget. First connection = " << std::boolalpha << firstConnection;
|
LMS_LOG(UI, DEBUG) << "Creating root widget. First connection = " << firstConnection;
|
||||||
|
|
||||||
if (firstConnection)
|
if (firstConnection)
|
||||||
{
|
{
|
||||||
@@ -127,8 +127,6 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnecti
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_auth = root()->addNew<Auth>();
|
|
||||||
|
|
||||||
LmsApp->getDb().getLogin().changed().connect(std::bind([=]
|
LmsApp->getDb().getLogin().changed().connect(std::bind([=]
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -141,6 +139,8 @@ LmsApplication::LmsApplication(const Wt::WEnvironment& env, Wt::Dbo::SqlConnecti
|
|||||||
throw std::runtime_error("Internal error");
|
throw std::runtime_error("Internal error");
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
_auth = root()->addNew<Auth>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user