/**
  * Returns a List of Users
  */
 public function actionIndex()
 {
     $form = new \humhub\modules\admin\models\forms\AuthenticationSettingsForm();
     if ($form->load(Yii::$app->request->post()) && $form->validate() && $form->save()) {
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
     }
     // Build Group Dropdown
     $groups = [];
     $groups[''] = Yii::t('AdminModule.controllers_SettingController', 'None - shows dropdown in user registration.');
     foreach (\humhub\modules\user\models\Group::find()->all() as $group) {
         if (!$group->is_admin_group) {
             $groups[$group->id] = $group->name;
         }
     }
     return $this->render('authentication', array('model' => $form, 'groups' => $groups));
 }
Example #2
0
 /**
  * Returns a List of Users
  */
 public function actionAuthentication()
 {
     $form = new \humhub\modules\admin\models\forms\AuthenticationSettingsForm();
     $form->internalUsersCanInvite = Setting::Get('internalUsersCanInvite', 'authentication_internal');
     $form->internalRequireApprovalAfterRegistration = Setting::Get('needApproval', 'authentication_internal');
     $form->internalAllowAnonymousRegistration = Setting::Get('anonymousRegistration', 'authentication_internal');
     $form->defaultUserGroup = Setting::Get('defaultUserGroup', 'authentication_internal');
     $form->defaultUserIdleTimeoutSec = Setting::Get('defaultUserIdleTimeoutSec', 'authentication_internal');
     $form->allowGuestAccess = Setting::Get('allowGuestAccess', 'authentication_internal');
     $form->defaultUserProfileVisibility = Setting::Get('defaultUserProfileVisibility', 'authentication_internal');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         $form->internalUsersCanInvite = Setting::Set('internalUsersCanInvite', $form->internalUsersCanInvite, 'authentication_internal');
         $form->internalRequireApprovalAfterRegistration = Setting::Set('needApproval', $form->internalRequireApprovalAfterRegistration, 'authentication_internal');
         $form->internalAllowAnonymousRegistration = Setting::Set('anonymousRegistration', $form->internalAllowAnonymousRegistration, 'authentication_internal');
         $form->defaultUserGroup = Setting::Set('defaultUserGroup', $form->defaultUserGroup, 'authentication_internal');
         $form->defaultUserIdleTimeoutSec = Setting::Set('defaultUserIdleTimeoutSec', $form->defaultUserIdleTimeoutSec, 'authentication_internal');
         $form->allowGuestAccess = Setting::Set('allowGuestAccess', $form->allowGuestAccess, 'authentication_internal');
         if (Setting::Get('allowGuestAccess', 'authentication_internal')) {
             $form->defaultUserProfileVisibility = Setting::Set('defaultUserProfileVisibility', $form->defaultUserProfileVisibility, 'authentication_internal');
         }
         // set flash message
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
         Yii::$app->response->redirect(Url::toRoute('/admin/setting/authentication'));
     }
     // Build Group Dropdown
     $groups = array();
     $groups[''] = Yii::t('AdminModule.controllers_SettingController', 'None - shows dropdown in user registration.');
     foreach (\humhub\modules\user\models\Group::find()->all() as $group) {
         $groups[$group->id] = $group->name;
     }
     return $this->render('authentication', array('model' => $form, 'groups' => $groups));
 }