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 }
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(); } }
public function setErrorMessage($e) { if (strpos($e->getMessage(), "contains invalid characters.")) { self::$saveUserName = strip_tags(self::$saveUserName); } self::$message = $e->getMessage(); }
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); }
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 />'; } } }
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; }
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); }
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> '; }
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; }
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 }
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); }
public function run() { $v = new RegisterView(); $v->run(); }
public function setErrorMissingFields() { self::$messageField = "Username has too few characters, at least 3 characters.<br>Password has too few characters, at least 6 characters."; }
public function __construct() { self::$sessionSaveLocation = Settings::MESSAGE_SESSION_NAME . Settings::APP_SESSION_NAME; self::$userSaveLocation = Settings::USER_SESSION_NAME . Settings::APP_SESSION_NAME; }
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); } }
public function setUserAndPassRegisterErrorMsg() { self::$message = "Username has too few characters, at least 3 characters.<br />Password has too few characters, at least 6 characters."; }