Ejemplo n.º 1
0
 public function testAutoSubscribesUserToEmails()
 {
     $this->fakeConfig->SetKey(ConfigKeys::REGISTRATION_AUTO_SUBSCRIBE_EMAIL, 'true');
     $user = User::Create($this->fname, $this->lname, $this->email, $this->login, $this->language, $this->timezone, $this->fakeEncryption->_Encrypted, $this->fakeEncryption->_Salt, $this->homepageId);
     $user->ChangeAttributes($this->phone, $this->organization, $this->position);
     $user->ChangeEmailPreference(new ReservationApprovedEvent(), true);
     $user->ChangeEmailPreference(new ReservationCreatedEvent(), true);
     $user->ChangeEmailPreference(new ReservationUpdatedEvent(), true);
     $user->ChangeEmailPreference(new ReservationDeletedEvent(), true);
     $this->userRepository->expects($this->once())->method('Add')->with($this->equalTo($user));
     $this->registration->Register($this->login, $this->email, $this->fname, $this->lname, $this->password, $this->timezone, $this->language, $this->homepageId, $this->additionalFields);
 }
Ejemplo n.º 2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/class.User.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/class.DataHandling.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/lib/reg_auth.inc';
if (isset($_POST['submit'])) {
    $post = GetPOST();
    $smarty->assign($fields = [User::ROOM_FLD => $post['room'], User::NAME_FLD => $post['name'], User::LOGIN_FLD => $post['login'], User::SURNAME_FLD => $post['surname']]);
    try {
        (new DataHandling())->ValidateLogin($post['login'])->ValidateRoom($post['room'])->ValidatePassword($post['pass'])->ValidateRepeatPasswords($post['pass'], $post['repass']);
        Registration::Register($fields, $post['pass']);
        DisplaySuccess('isRegister', true);
    } catch (Exception $e) {
        $smarty->assign('db_error', $e->getMessage());
    }
}
$smarty->display('registration.tpl');