public function actionDefault($id) { if (!($clanek = $this->redakce->findClanekByUrl($id))) { $this->id_rubriky = $this->redakce->id_hlavni_skupiny; $this->setView('clanekNenalezen'); } elseif ($id != $clanek['url']) { if ($clanek['zobrazit_od']->getTimestamp() > time() || $clanek['zobrazit_do']->getTimestamp() < time()) { $this->setView('clanekNenalezen'); } else { $this->redirect('default', $clanek['url']); } } else { $this->id_clanku = $clanek->id; $this->template->clanek = $clanek; $this->template->autor = $this->osobyRepository->findById($clanek['autor']); $this->clanky = $this->redakce->podobneClanky($clanek->id, $this->pocet_podobnych_clanku, $clanek->rubrika); $this->rubriky = $this->rubriky = $this->redakce->findRubrikyByRodic($clanek->rubrika); $this->id_rubriky = $clanek->rubrika; $rubrika = $this->redakce->findRubrikuById($clanek->rubrika); if ($rubrika->rodic == $this->redakce->id_hlavni_skupiny || $rubrika['id'] == $this->redakce->id_hlavni_skupiny) { $this->mininavigace[] = array('nazev' => $rubrika->nazev, 'url' => 'Homepage:rubriky', 'parametry' => $rubrika->url, 'poradi' => '2'); $this->nazev_rubriky = $rubrika->nazev; $this->id_rubriky_pro_akce = $rubrika->id; } else { $rodic = $this->redakce->findRubrikuById($rubrika->rodic); $this->mininavigace[] = array('nazev' => $rodic->nazev, 'url' => 'Homepage:rubriky', 'parametry' => $rodic->url, 'poradi' => '2'); $this->mininavigace[] = array('nazev' => $rubrika->nazev, 'url' => 'Homepage:rubriky', 'parametry' => $rodic->url . '/' . $rubrika->url, 'poradi' => '3'); $this->nazev_rubriky = $rodic->nazev; $this->id_rubriky_pro_akce = $rodic->id; } } }
public function actionDefault($text = null) { if (!$text) { $this->setView('formular'); } else { $this->clanky = $this->redakce->findClankyFulltext($text); $this->template->oddily = $this->oddilyRepository->vyhledatOddily($text); $this->template->osoby = $this->osobyRepository->vyhledatOsoby($text); $this->template->akce = $this->spravceAkci->vyhledatAkce($text); } }
/** * * @param array $credentials * @return \NIdentity * @throws NAuthenticationException */ public function authenticate(array $credentials) { list($username, $password) = $credentials; $row = $this->repository->findByUsername($username); if (!$row) { throw new NAuthenticationException("Neplatné jméno nebo heslo."); } if ($row->password !== self::calculateHash($password, $row->password)) { throw new NAuthenticationException('Neplatné jméno nebo heslo', self::INVALID_CREDENTIAL); } unset($row->password); return new NIdentity($row->id, NULL, $row->toArray()); }
public function potvrditZmenuHeslaFormSubmitted(PotvrditZmenuHeslaForm $form) { $values = $form->getValues(); $osoby = $this->osobyRepository->findBy(array('password' => $values['klic'])); if ($osoby->count() != 1) { $this->redirect('chyba'); } $osoba = $osoby->fetch(); $email = $osoba['email']; $username = $osoba['username']; dd($osoba, 'osoba'); if ($osoba['id'] != $values['id_osoby']) { $this->redirect('chyba'); } $heslo = Authenticator::generovatHeslo(); $this->osobyRepository->zmenitHeslo($osoba['id'], $heslo); $this->logg("osoba " . $osoba['id'] . " - vygenerovány nové přístupové údaje"); $mail = $this->odeslani_mailu->createMail(); $mail->addTo($email)->setSubject('Přístupové údaje k systému GIS')->setBody("Vaše nové přihlašovací údaje k systému GIS:\nuživatelské jméno: " . $username . "\nuživatelské heslo: {$heslo} \n\nPřihlásit se můžete na adrese " . $this->context->parameters['prihlasovaci_stranka'] . "\n\nPo prvním přihlášení si změňte heslo.\nEmail je generován strojově, prosím, neodpovídejte.\n"); $mail->send(); $this->flashMessage('Nové heslo bylo odesláno na Váš email.'); $this->redirect('Login:default'); }
public function vygenerovatPristupoveUdaje($id) { $zaznam = $this->osobyRepository->findById($id); if ($zaznam->email) { if (!$zaznam->username) { $username = $this->osobyRepository->generovatUsername($id); $this->osobyRepository->zmenitUzivatelskeJmeno($id, $username); } else { $username = $zaznam->username; } $heslo = Authenticator::generovatHeslo(); $this->osobyRepository->zmenitHeslo($id, $heslo); $this->logg("osoba {$id} - vygenerovány nové přístupové údaje"); $mail = $this->odeslani_mailu->createMail(); $mail->addTo($zaznam->email)->setSubject('Přístupové údaje k systému GIS')->setBody("Vaše nové přihlašovací údaje k systému GIS:\nuživatelské jméno: {$username} \nuživatelské heslo: {$heslo} \nPřihlásit se můžete na adrese " . $this->context->parameters['prihlasovaci_stranka'] . "\n Po prvním přihlášení si změňte heslo.\nEmail je generován strojově, prosím, neodpovídejte.\n"); $mail->send(); $this->flashMessage('Nové heslo bylo odesláno.'); return TRUE; } else { $this->logg("osoba {$id} - nelze vygenerovat heslo, není zadaný email"); $this->flashMessage('Nelze vygenerovat heslo, není vyplněný email', 'error'); return FALSE; } }