Bug #7128 ยป issue_7128.patch
src/Wt/Auth/AuthModel.C | ||
---|---|---|
bool AuthModel::login(Login& login)
|
||
{
|
||
if (valid()) {
|
||
// self: keep model alive until function returns
|
||
// loginUser can cause Login::changed() signal
|
||
// to be emitted. A slot may be connected that
|
||
// deletes the widget that is the sole owner of this model
|
||
auto self = shared_from_this();
|
||
User user = users().findWithIdentity(Identity::LoginName,
|
||
valueText(LoginNameField));
|
||
cpp17::any v = value(RememberMeField);
|
src/Wt/Auth/AuthModel.h | ||
---|---|---|
#include <Wt/Auth/Identity.h>
|
||
#include <Wt/Auth/User.h>
|
||
#include <memory>
|
||
namespace Wt {
|
||
namespace Auth {
|
||
... | ... | |
*
|
||
* \ingroup auth
|
||
*/
|
||
class WT_API AuthModel : public FormBaseModel
|
||
class WT_API AuthModel : public FormBaseModel, public std::enable_shared_from_this<AuthModel>
|
||
{
|
||
public:
|
||
//! \brief Password field
|
src/Wt/Auth/AuthWidget.C | ||
---|---|---|
AuthWidget::AuthWidget(const AuthService& baseAuth,
|
||
AbstractUserDatabase& users, Login& login)
|
||
: WTemplateFormView(WString::Empty),
|
||
model_(new AuthModel(baseAuth, users)),
|
||
model_(std::make_shared<AuthModel>(baseAuth, users)),
|
||
login_(login)
|
||
{
|
||
init();
|
||
... | ... | |
app->theme()->apply(this, this, AuthWidgets);
|
||
}
|
||
void AuthWidget::setModel(std::unique_ptr<AuthModel> model)
|
||
void AuthWidget::setModel(const std::shared_ptr<AuthModel> &model)
|
||
{
|
||
model_ = std::move(model);
|
||
model_ = model;
|
||
}
|
||
void AuthWidget::setRegistrationEnabled(bool enabled)
|
||
... | ... | |
}
|
||
}
|
||
std::unique_ptr<RegistrationModel> AuthWidget::registrationModel()
|
||
{
|
||
return createRegistrationModel();
|
||
}
|
||
std::unique_ptr<RegistrationModel> AuthWidget::createRegistrationModel()
|
||
{
|
||
auto result = std::unique_ptr<RegistrationModel>
|
||
... | ... | |
std::unique_ptr<WWidget> AuthWidget::createRegistrationView(const Identity& id)
|
||
{
|
||
auto model = registrationModel();
|
||
auto model = createRegistrationModel();
|
||
if (id.isValid())
|
||
model->registerIdentified(id);
|
||
... | ... | |
{
|
||
return std::unique_ptr<WWidget>
|
||
(new UpdatePasswordWidget
|
||
(user, registrationModel(),
|
||
(user, createRegistrationModel(),
|
||
promptPassword ? model_ : std::shared_ptr<AuthModel>()));
|
||
}
|
||
src/Wt/Auth/AuthWidget.h | ||
---|---|---|
*
|
||
* This sets a model to be used for authentication.
|
||
*/
|
||
void setModel(std::unique_ptr<AuthModel> model);
|
||
void setModel(const std::shared_ptr<AuthModel> &model);
|
||
/*! \brief Returns the model.
|
||
*
|
||
... | ... | |
void oAuthStateChange(OAuthProcess *process);
|
||
void oAuthDone(OAuthProcess *process, const Identity& identity);
|
||
void updatePasswordLoginView();
|
||
std::unique_ptr<RegistrationModel> registrationModel();
|
||
};
|
||
}
|
src/Wt/WContainerWidget.C | ||
---|---|---|
// we need to delete the old value first, otherwise we run into problems
|
||
// FIXME: maybe the code should be fixed so this is not necessary? Having
|
||
// to call reset() first feels dirty
|
||
layout_.reset();
|
||
clear();
|
||
layout_ = std::move(layout);
|
||
if (layout_)
|