Adding User edit/create view

This commit is contained in:
emeric
2018-04-10 13:24:14 +02:00
parent 05fd8a47d8
commit 2f7697d278
21 changed files with 510 additions and 64 deletions
+12 -5
View File
@@ -164,7 +164,6 @@ Handler::getCurrentUser()
User::pointer
Handler::getUser(const Wt::Auth::User& authUser)
{
if (!authUser.isValid()) {
LMS_LOG(DB, ERROR) << "Handler::getUser: invalid authUser";
return User::pointer();
@@ -172,13 +171,21 @@ Handler::getUser(const Wt::Auth::User& authUser)
Wt::Dbo::ptr<AuthInfo> authInfo = _users->find(authUser);
User::pointer user = authInfo->user();
return authInfo->user();
}
if (!user) {
user = _session.add(new User());
authInfo.modify()->setUser(user);
User::pointer
Handler::createUser(const Wt::Auth::User& authUser)
{
if (!authUser.isValid()) {
LMS_LOG(DB, ERROR) << "Handler::getUser: invalid authUser";
return User::pointer();
}
User::pointer user = _session.add(new User());
Wt::Dbo::ptr<AuthInfo> authInfo = _users->find(authUser);
authInfo.modify()->setUser(user);
return user;
}