コード例 #1
0
ファイル: LayoutView.php プロジェクト: ej222ru/1DV608_A4
    public function renderRegister($isLoggedIn, RegisterView $r, DateTimeView $dtv)
    {
        ?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Login Example</title>
  </head>
  <body>
    <h1>Assignment 2</h1>
    <a href='?'>Back to login</a>
    <?php 
        if ($isLoggedIn) {
            echo "<h2>Logged in</h2>";
        } else {
            echo "<h2>Not logged in</h2>";
        }
        ?>
        <div class="container" >
          <?php 
        echo $r->response();
        $dtv->show();
        ?>
        </div>
      <div>
      <em>This site uses cookies to improve user experience. By continuing to browse the site you are agreeing to our use of cookies.</em>
    </div>
   </body>
</html>
<?php 
    }
コード例 #2
0
 private function renderViewResponse(LoginView $v_lv, RegisterView $v_rv, NavigationView $v_nv)
 {
     if ($v_nv->inRegistration()) {
         return $v_rv->response();
     } else {
         return $v_lv->response();
     }
 }
コード例 #3
0
ファイル: RegisterView.php プロジェクト: al223jw/1DV608-PHP
 public function setErrorMessage($e)
 {
     if (strpos($e->getMessage(), "contains invalid characters.")) {
         self::$saveUserName = strip_tags(self::$saveUserName);
     }
     self::$message = $e->getMessage();
 }
コード例 #4
0
 public function registerViewHTML()
 {
     //create the view class with the form submision endpoint
     $registerView = new RegisterView(self::FORMSUBMITENDPOINT);
     /*
     I can see if the user just tried to register his account and failed by checking $this->registerErrorMessage 
     if it is not equal to "" then the user just tried to submit the register form and failed,therefore I can
     take all the details he entered and reuse them,saving him having to retype all the details.I will however make him
     retype the password fields so im just taking the name and email from $_POST
     */
     //I will pass in an empty string if there is no posted register fields
     $presetName = "";
     $presetEmail = "";
     //do the check and set the apropriate values
     if ($this->registerErrorMessage != "") {
         //Im going to double check that we actually have the $_POST variable just incase
         if (isset($_POST[REGISTERNAME])) {
             $presetName = $_POST[REGISTERNAME];
         }
         if (isset($_POST[REGISTEREMAIL])) {
             $presetEmail = $_POST[REGISTEREMAIL];
         }
     }
     $registerView->HTML($presetName, $presetEmail, $this->registerErrorMessage);
 }
コード例 #5
0
 public function setMessage()
 {
     $this->message = '';
     if ($this->hasUserTriedToRegister()) {
         if (isset($_SESSION['successfulRegistration']) && !$_SESSION['successfulRegistration']) {
             $this->message .= "User exists, pick another username.<br />";
             unset($_SESSION['successfulRegistration']);
         }
         if (!$this->ValidateCredentials->isUserNameValid()) {
             $inputUname = $this->getInputUname();
             if (mb_strlen($inputUname) < 3) {
                 $this->message .= 'Username has too few characters, at least 3 characters.<br />';
             }
             if (preg_match("/^[A-Za-z0-9]+\$/", $inputUname) == 0 && $inputUname != "") {
                 $this->message .= 'Username contains invalid characters.<br />';
                 self::$keepName = strip_tags($inputUname);
             }
         }
         if (!$this->ValidateCredentials->isPasswordValid()) {
             $this->message .= 'Password has too few characters, at least 6 characters.<br />';
         }
         if (!$this->doesPasswordsMatch()) {
             $this->message .= 'Passwords do not match.<br />';
         }
     }
 }
コード例 #6
0
 public function isUserValid($userList)
 {
     $isValid = true;
     // var_dump($userList);
     // exit();
     if ($isValid) {
         foreach ($userList as $user) {
             if ($user !== null) {
                 if ($user->getUserName() == $_POST[self::$userName]) {
                     self::$message = "User exists, pick another username.";
                     $isValid = false;
                 }
             }
         }
     }
     if (strlen($_POST[self::$userName]) < 3) {
         self::$message .= 'Username has too few characters, at least 3 characters.<br />';
         $isValid = false;
     }
     if (strlen($_POST[self::$password]) < 6) {
         self::$message .= 'Password has too few characters, at least 6 characters.<br />';
         $isValid = false;
     }
     if ($_POST[self::$password] != $_POST[self::$passwordRepeat]) {
         self::$message = 'Passwords do not match.';
         $isValid = false;
     } else {
         if (preg_match('/[^A-Za-z0-9.#\\-$]/', $_POST[self::$userName])) {
             self::$message = 'Username contains invalid characters.';
             $isValid = false;
         }
     }
     return $isValid;
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $username = JRequest::getVar('username', '');
     $password = JRequest::getVar('password', '');
     $this->assignRef('username', $username);
     $this->assignRef('password', $password);
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_REGISTER_LABEL_USER_REGISTRATION"));
     parent::display($tpl);
 }
コード例 #8
0
 public function renderRegister($isLoggedIn, RegisterView $rv, DateTimeView $dtv, NavigationView $nv)
 {
     echo '<!DOCTYPE html>
   <html>
     <head>
       <meta charset="utf-8">
       <title>Assignment 4</title>
     </head>
     <body>
       <h1>Assignment 4</h1>
       ' . $nv->getLinks() . $this->renderIsLoggedIn($isLoggedIn) . '
       <h2>Register new user</h2>
       <div class="container">
           ' . $rv->generateRegistrationFormHTML() . ' 
           
           ' . $dtv->show() . '
       </div>
      </body>
   </html>
 ';
 }
コード例 #9
0
ファイル: LayoutView.php プロジェクト: jc222fi/PHP-Ass4
 public function render($isLoggedIn, NavigationView $nv, LoginView $v, RegisterView $rv, DateTimeView $dtv)
 {
     $ret1 = '<!DOCTYPE html>
   <html>
     <head>
       <meta charset="utf-8">
       <title>Login Example</title>
     </head>
     <body>
       <h1>Assignment 4</h1>';
     echo $ret1;
     if (!$isLoggedIn) {
         if ($nv->userWantsToRegister()) {
             $ret3 = $nv->getLinkToLogin();
         } else {
             $ret3 = $nv->getLinkToRegister("Register a new user");
         }
     }
     $ret3 .= '
       ' . $this->renderIsLoggedIn($isLoggedIn) . '
       <div class="container">
       ';
     echo $ret3;
     if ($rv->isUserDoneRegistering() || !$nv->userWantsToRegister()) {
         $ret2 = $v->response($rv->getProvidedUsername());
     } else {
         $ret2 = $rv->response();
     }
     $ret2 .= '    ' . $dtv->show() . '
       </div>
       <div>
         <em>This site uses cookies to improve user experience. By continuing to browse the site you are agreeing to our use of cookies.</em>
       </div>
     </body>
     </html>
 ';
     echo $ret2;
 }
コード例 #10
0
    public function render($isLoggedIn, LoginView $v, DateTimeView $dtv, RegisterView $rv)
    {
        ?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Login Example</title>
  </head>
  <body>
    <h1>Assignment 2</h1>
    <?php 
        if ($rv->userClickedOnRegister()) {
            echo $rv->getBackLink();
        } else {
            if (!$isLoggedIn) {
                echo $rv->getRegistrationLink();
            }
        }
        if ($isLoggedIn) {
            echo "<h2>Logged in</h2>";
        } else {
            echo "<h2>Not logged in</h2>";
        }
        ?>
    <div class="container" >
      <?php 
        if ($rv->userClickedOnRegister() && $rv->registrationSucceeded() === FALSE) {
            echo $rv->response();
        } else {
            echo $v->response();
        }
        $dtv->show();
        ?>
    </div>

    <div>
      <em>This site uses cookies to improve user experience. By continuing to browse the site you are agreeing to our use of cookies.</em>
    </div>
   </body>
</html>
<?php 
    }
コード例 #11
0
ファイル: view.html.php プロジェクト: ErickLopez76/offiria
 function display($tpl = null)
 {
     $email = JRequest::getVar('email', '');
     $token = JRequest::getString('token', '');
     $code = JRequest::getString('code', '');
     $userInviteTable = JTable::getInstance('usersInvite', 'AccountTable');
     $userInviteTable->load(array('invite_email' => $email, 'status' => AccountTableUsersInvite::PENDING, 'token' => $token));
     $username = JRequest::getVar('username', '');
     $name = JRequest::getVar('name', '');
     $password = JRequest::getVar('password', '');
     $confirmPassword = JRequest::getVar('confirm_password', '');
     $this->assignRef('name', $name);
     $this->assignRef('username', $username);
     $this->assignRef('password', $password);
     $this->assignRef('confirm_password', $confirmPassword);
     $this->assignRef('email', $email);
     $this->assignRef('token', $token);
     $this->assignRef('code', $code);
     $doc = JFactory::getDocument();
     $doc->setTitle(JText::_("COM_REGISTER_LABEL_USER_REGISTRATION"));
     parent::display($tpl);
 }
コード例 #12
0
 public function run()
 {
     $v = new RegisterView();
     $v->run();
 }
コード例 #13
0
 public function setErrorMissingFields()
 {
     self::$messageField = "Username has too few characters, at least 3 characters.<br>Password has too few characters, at least 6 characters.";
 }
コード例 #14
0
 public function __construct()
 {
     self::$sessionSaveLocation = Settings::MESSAGE_SESSION_NAME . Settings::APP_SESSION_NAME;
     self::$userSaveLocation = Settings::USER_SESSION_NAME . Settings::APP_SESSION_NAME;
 }
コード例 #15
0
ファイル: register.php プロジェクト: RuseHackV2/LifePlus
 public function init()
 {
     session_start();
     $registerView = new RegisterView();
     if (!isset($_SESSION['username'])) {
         $registerView->initView();
     } else {
         header('Location: http://date.me/index.php?home');
         exit;
     }
     if (isset($_POST['submit'])) {
         $user = $this->data_processing();
         $this->get_user_id($user);
         $this->image_processing($user);
     }
 }
コード例 #16
0
ファイル: RegisterView.php プロジェクト: babylonQ/1DV608
 public function setUserAndPassRegisterErrorMsg()
 {
     self::$message = "Username has too few characters, at least 3 characters.<br />Password has too few characters, at least 6 characters.";
 }