コード例 #1
0
ファイル: uasValidators.php プロジェクト: habtom/uas
 protected function doClean($password)
 {
     $login = $_POST['credentials']['login'];
     $user = UserPeer::getUserFromLogin($login);
     if (!$user->checkPassword(new Password($password))) {
         throw new sfValidatorError($this, 'invalid');
     }
     return $password;
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: habtom/uas
 public function executeDologin(sfWebRequest $request)
 {
     $form = new LoginForm();
     $form->bind($this->getRequestParameter('credentials'));
     if ($form->isValid()) {
         $login = $request->getParameter('credentials[login]');
         $user = UserPeer::getUserFromLogin($login);
         // set the session correctly
         $this->getUser()->setAuthenticated(true);
         $this->getUser()->setAttribute('user_id', $user->getId());
         $this->getUser()->setFlash('notice', 'Welcome' . ' ' . $user->getLogin());
         $this->redirect('user/show?id=' . $user->getId());
     } else {
         // give the form again
         $this->form = $form;
         $this->setTemplate('login');
     }
 }
コード例 #3
0
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // add your code here
     $from = $arguments['from'] ? $arguments['from'] : '';
     $to = $arguments['to'] ? $arguments['to'] : '';
     $connection = Propel::getConnection();
     $query = "SELECT login FROM " . UserPeer::TABLE_NAME . " WHERE length(login) < 5 or login like '%/%'";
     $result = $connection->query($query);
     while ($row = $result->fetch()) {
         $user = UserPeer::getUserFromLogin($row['login']);
         echo $user->setLogin($user->generateLogin());
         echo " ";
         echo $user->getLogin();
         echo "\n";
         $user->save();
     }
 }
コード例 #4
0
    protected function execute($arguments = array(), $options = array())
    {
        // initialize the database connection
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
        $to = $arguments['to'] ? $arguments['to'] : '';
        // TODO : get login, localparts names
        $subject = "Notification";
        $headers = 'From: ICT <*****@*****.**>';
        $message = <<<EOF
Hello #FIRSTNAME# #FATHERSNAME#,

We would like to inform you about the following.

Your login name for the User Adminitration System is: #LOGIN# 

Please go to http://mail.ju.edu.et/uas/ to use it.  The password to log in
is the same as for the email system.

Login in into the email system is still done with your email address.

Thank you for your cooperation.  We hope you will enjoy the UAS.
Expect us to expand its functionality in the future.

The ICT Development office
EOF;
        $users = array();
        if ($to != '') {
            $users[] = UserPeer::getUserFromLogin($to);
        } else {
            $users = UserPeer::getEmailAccounts();
        }
        foreach ($users as $user) {
            $login = $user->getLogin();
            $search = array("#LOGIN#", "#FIRSTNAME#", "#FATHERSNAME#", "#EMAILADDRESS#");
            $replace = array($user->getLogin(), $user->getName(), $user->getFathersName(), $user->getEmailAddress());
            if (!mail($user->getEmailAddress(), $subject, str_replace($search, $replace, $message), $headers)) {
                echo "message failed";
            }
        }
    }