public function login() { // Redirect to browser if user is already logged in if (System::getUser() != NULL) { System::forwardToRoute(Router::getInstance()->build('BrowserController', 'index')); exit; } $username = Utils::getPOST('username'); $password = Utils::getPost('password'); if (Utils::getPOST('submit', false) != false) { $user = User::find('username', $username); if ($user != NULL && $user->login($password)) { System::forwardToRoute(Router::getInstance()->build('HomeController', 'index')); exit; } else { System::getSession()->setData('errorMsg', System::getLanguage()->_('LogInFailed')); } } $smarty = new Template(); $smarty->assign('title', System::getLanguage()->_('LogIn')); if ($_SERVER['SERVER_NAME'] == 'localhost' && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false) { $smarty->assign('showChromeInfo', true); } else { $smarty->assign('showChromeInfo', false); } $smarty->requireResource('auth'); $smarty->display('auth/login.tpl'); }
?> " /> <input type="password" id="reg_password" name="reg_password" class="form-control" placeholder="<?php echo I18n::get("password"); ?> " value="<?php echo Utils::getPost("reg_password"); ?> " /> <input type="password" id="pwd_check" name="pwd_check" class="form-control" placeholder="<?php echo I18n::get("repeat_password"); ?> " value="<?php echo Utils::getPost("repeat_password"); ?> " /> <input type="submit" class="btn btn-primary" value="<?php echo I18n::get("register"); ?> " /> </form> </div> </div> </div> <?php include_once __DIR__ . "/template/bottom.php";