Skip to content

Commit

Permalink
fix(form): Form with restricted acces: redirect to login form if not …
Browse files Browse the repository at this point in the history
…logged in

If form has restriced access, and user is not logged in, it should show login form with redirect.
Refer #2734
  • Loading branch information
Kaya84 authored and btry committed Apr 29, 2022
1 parent 5960a8d commit fe1eadd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions front/formdisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
Html::displayNotFoundError();
}

// If the form has restriced access and user is not logged in, send to login form
if ($form->fields['access_rights'] == PluginFormcreatorForm::ACCESS_RESTRICTED && Session::getLoginUserID() === false) {
Session::redirectIfNotLoggedIn();
exit();
}

if (!$form->canViewForRequest()) {
Html::displayRightError();
exit();
Expand Down

0 comments on commit fe1eadd

Please sign in to comment.