diff options
Diffstat (limited to 'app/model')
-rw-r--r-- | app/model/datamods.php | 22 | ||||
-rw-r--r-- | app/model/deleteaccount.php | 6 |
2 files changed, 24 insertions, 4 deletions
diff --git a/app/model/datamods.php b/app/model/datamods.php index c7c7da1..e2051f3 100644 --- a/app/model/datamods.php +++ b/app/model/datamods.php @@ -32,7 +32,13 @@ if (isAction("dm-group-add")) if (!$form->populate(input())) return; - $group = group::initNew($form->name, user::getCurrent()); + if (!($user = user::getCurrent())) + { + logError(ERROR, "You must be logged in to create a group"); + return; + } + + $group = group::initNew($form->name, $user); } /* @@ -48,7 +54,12 @@ if (isAction("dm-pad-add")) return; $owner = agent::getAgentObj($form->owner); - $user = user::getCurrent(); + + if (!($user = user::getCurrent())) + { + logError(ERROR, "You must be logged in to create a pad"); + return; + } if (!$user->canCreateSub($owner)) { @@ -78,7 +89,12 @@ if (isAction("dm-issue-add")) return; $pad = new pad($form->pad); - $user = user::getCurrent(); + + if (!($user = user::getCurrent())) + { + logError(ERROR, "You must be logged in to open an issue"); + return; + } if (!$user->canCreateSub($pad)) { diff --git a/app/model/deleteaccount.php b/app/model/deleteaccount.php index 8153f0f..d83537e 100644 --- a/app/model/deleteaccount.php +++ b/app/model/deleteaccount.php @@ -26,7 +26,11 @@ if (isAction("deleteaccount")) if (!$form->populate(input())) return; - $user = user::getCurrent(); + if (!($user = user::getCurrent())) + { + logError(ERROR, "You must be logged in to close your account"); + return; + } if (!$user->validatePasswd($form->passwd)) { |