Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make site visible to particular user?
    primarykey
    data
    text
    <p>I have client requirement that he is moving his site from development server to production server.</p> <p>He want to do some testing and other stuff before going live completely. So what he want is to make the site visible to him only (using some authentication).</p> <p>As soon as he try to access the any url of site,he should be redirected to a login page.This login page is different than magento login page which covers the whole screen so the site content should not be visible until he login .(There should be no registration facility,this is a user specific login ) </p> <p>Only after login with a specified password and username he will be allowed to see the site content.</p> <p>I tried some thing like this in my index.php</p> <pre><code>$basePath=getcwd(); </code></pre> <p>require_once $basePath.'/app/Mage.php'; Mage::init();</p> <p>$currentUrl = Mage::helper('core/url')->getCurrentUrl(); //echo $currentUrl."<br/>";//exit;</p> <p>if(strpos($currentUrl,"?k=1") ) { $validation=1;<br> } else { $validation=0; }</p> <p>//exit; if($validation==0 ) {<br> // echo "<br/>In if validation 0";<br> include 'Loginform.php'; } else {<br> echo "ddd"; /<em>exit;</em>/</p> <pre><code> /** * Error reporting */ error_reporting(E_ALL | E_STRICT); /** * Compilation includes configuration file */ define('MAGENTO_ROOT', getcwd()); $compilerConfig = MAGENTO_ROOT . '/includes/config.php'; if (file_exists($compilerConfig)) { include $compilerConfig; } $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; $maintenanceFile = 'maintenance.flag'; if (!file_exists($mageFilename)) { if (is_dir('downloader')) { header("Location: downloader"); } else { echo $mageFilename." was not found"; } exit; } if (file_exists($maintenanceFile)) { include_once dirname(__FILE__) . '/errors/503.php'; exit; } require_once $mageFilename; #Varien_Profiler::enable(); if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(true); } #ini_set('display_errors', 1); umask(0); /* Store or website code */ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; Mage::run($mageRunCode, $mageRunType); </code></pre> <p>and I created a file Loginform.php in base directory which has content .</p> <pre><code>&lt;?php $basePath=getcwd(); require_once $basePath.'/app/Mage.php'; Mage::init(); $cust=Mage::getModel('customer/customer')-&gt;getCollection(); foreach($cust as $customer) { //echo $customer-&gt;getEmail(); } // echo "&lt;br/&gt;"; // echo $_POST['username']; $email=$_POST['username']; echo "&lt;br/&gt;"; //echo $_POST['password']; //echo md5($_POST['password']); $password=$_POST['password']; echo "&lt;br/&gt;"; $customer = Mage::getModel('customer/customer')-&gt;setWebsiteId(Mage::app()-&gt;getStore()-&gt;getWebsiteId()); try { if($customer-&gt;authenticate($email,$password)) { //echo 'success&lt;br/&gt;'; $url=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); //exit; $url=$url.'index.php'.'?k=1'; //echo $url; //Mage::app()-&gt;getResponse()-&gt;setRedirect($url); //Redirecting to base url //Mage::app()-&gt;getFrontController()-&gt;getResponse()-&gt;setRedirect($url); header("Location:$url"); } } catch (Mage_Core_Exception $e ) { echo $e-&gt;getMessage(); } ?&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post" action="Loginform.php"&gt; User Name&lt;input type="text" name="username"/&gt; Password&lt;input type="password" name="password"/&gt; &lt;input type="submit" name="submit" value="submit"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>But using this logic I am facing lot of problems. Please suggest some solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload