/** * */ public function sync() { $appParams = DF::model("Bootstrap.AppParams")->load(); $settings = ApiFactory::model('Bootstrap.Currency')->get(); foreach ($settings as $k => $v) { $appParams->put($k, $v); } $this->init($settings); }
/** * */ public function admin_get($domainName) { $model = DF::model('AppParams.AppParams'); $appParams = $model->load($domainName); $domainPath = "\\App\\Modules\\AppParams\\Models\\Domains\\{$domainName}"; $domain = (new $domainPath())->init()->usingData($appParams); $this->view->data(['html' => new \Lib\Html(), 'url_app_params_root' => $this->http()->url('app_params'), 'domainName' => $domainName, 'domain' => $domain]); $this->components(['app_params as content']); }
/** * */ protected function loadAppParams($domain = 'Core') { $appParams = DF::model("AppParams.AppParams")->load($domain); $hooks = \Lib\Hooks::instance(); $params = $appParams->get('*'); foreach ($params as $param => $value) { $hooks->addAnswer($param, $value); } return $appParams; }
/** * */ private function registerScopes($loginId) { $model = DF::model('Authentication.LoginsToScopes'); $qst = Query::create($model)->where(Caml::eq('loginId', ':loginId'))->toSql(); $rst = $model->execute($qst, ['loginId' => $loginId])->result(); if ($rst) { foreach ($rst as $row) { $this->setScopes($row['scope']); } } return $this; }
public function post() { $post = $this->app->request()->post(); $loginModel = DataFactory::model('Authentication.Logins'); $username = $post['username']; $authentication = $loginModel->authenticateByCredentials($username, $post['password']); if (!$authentication) { $this->flashMessages()->warning(sprintf($this->view->lang()->say('login failed'), $loginModel->waitBetweenAttempts())); $this->response->redirect('/login'); } else { $this->app->module()->authenticationCookieSet($authentication['token'], $authentication['timeout']); $this->response->redirect('/'); } }
/** * */ public function logout() { $token = (new \Lib\CookieRequest())->{$this->authCookieName}; $loginModel = DataFactory::model('Authentication.Logins'); $loginModel->cleanByCookie($token); $this->authenticationCookieSet(self::TOKEN_LOGOUT, time() - 60); // delete }