Commit bdef0616 by tetiana yaremko

strong password modified

css responsive added
parent 2930ad1c
......@@ -23,8 +23,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'https://wbt-2-ty-272811.appspot.com/';
//$config['base_url'] = 'http://localhost/webapp/ci/';
//$config['base_url'] = 'https://wbt-2-ty-272811.appspot.com/';
$config['base_url'] = 'http://localhost/webapp/ci/';
/*
|--------------------------------------------------------------------------
......@@ -379,22 +379,22 @@ $config['encryption_key'] = 'femEDWTX$AQ@6HggkKn8RWGf!*ufK?KC';
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'memcached';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'localhost:11211';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 7200;
$config['sess_regenerate_destroy'] = FALSE;
//$config['sess_driver'] = 'database';
//$config['sess_driver'] = 'memcached';
//$config['sess_cookie_name'] = 'ci_session';
//$config['sess_expiration'] = 7200;
//$config['sess_save_path'] = 'ci_sessions';
//$config['sess_save_path'] = 'localhost:11211';
//$config['sess_match_ip'] = FALSE;
//$config['sess_time_to_update'] = 7200;
//$config['sess_regenerate_destroy'] = FALSE;
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 7200;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
......
......@@ -75,12 +75,12 @@ $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => '104.199.82.156',
'username' => 'tetiana',
'password' => 'yaremko_tetiana',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => '',
// 'hostname' => '104.199.82.156',
// 'username' => 'tetiana',
// 'password' => 'yaremko_tetiana',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'mydb',
'dbdriver' => 'mysqli',
'dbprefix' => '',
......
......@@ -26,7 +26,7 @@ class Admin extends CI_Controller {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = 2048;
$config['max_size'] = 4048;
$file_name="image".time();
$config['file_name']=$file_name;
$this->upload->initialize($config);
......
......@@ -85,7 +85,7 @@ class Auth extends CI_Controller
$this->logged_in_check();
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]',
array('is_unique' => 'This email has already registered'));
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]|callback_valid_password');
$this->form_validation->set_rules('password2', 'Confirm password', 'required|matches[password]|min_length[8]');
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('surname', 'Surname', 'required');
......@@ -103,7 +103,6 @@ class Auth extends CI_Controller
redirect("auth/registration_success", $name);
}
$this->load->view('register');
}
......@@ -192,7 +191,7 @@ class Auth extends CI_Controller
if(!$this->session->userdata('reset_email')) {
redirect('auth/login');
}
$this->form_validation->set_rules('new_password', 'Password', 'trim|required|min_length[8]');
$this->form_validation->set_rules('new_password', 'Password', 'trim|required|min_length[8]|callback_valid_password');
$this->form_validation->set_rules('new_password2', 'Confirm password', 'trim|required|matches[new_password]|min_length[8]');
if($this->form_validation->run() == false) {
$this->load->view('passReset');
......@@ -211,8 +210,55 @@ class Auth extends CI_Controller
public function registration_success() {
$this->load->view('registration_sucessful');
$this->load->view('registration_successful');
}
public function valid_password($password = '')
{
$password = trim($password);
$regex_lowercase = '/[a-z]/';
$regex_uppercase = '/[A-Z]/';
$regex_number = '/[0-9]/';
$regex_special = '/[!@#$%^&*()\-_=+{};:,<.>§~]/';
if (empty($password))
{
$this->form_validation->set_message('valid_password', 'The {field} field is required.');
return FALSE;
}
if (preg_match_all($regex_lowercase, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least one lowercase letter.');
return FALSE;
}
if (preg_match_all($regex_uppercase, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least one uppercase letter.');
return FALSE;
}
if (preg_match_all($regex_number, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must have at least one number.');
return FALSE;
}
if (preg_match_all($regex_special, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must have at least one special character.' . ' ' . htmlentities('!@#$%^&*()\-_=+{};:,<.>§~'));
return FALSE;
}
if (strlen($password) < 5)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least 5 characters in length.');
return FALSE;
}
if (strlen($password) > 32)
{
$this->form_validation->set_message('valid_password', 'The {field} field cannot exceed 32 characters in length.');
return FALSE;
}
return TRUE;
}
......
......@@ -39,7 +39,7 @@ class User extends CI_Controller
}
}
elseif (isset($_POST['update-password'])) {
$this->form_validation->set_rules('update_password', 'Password', 'trim|required|min_length[8]');
$this->form_validation->set_rules('update_password', 'Password', 'trim|required|min_length[8]|callback_valid_password');
$this->form_validation->set_rules('update_password2', 'Confirm password', 'trim|required|matches[update_password]|min_length[8]');
if ($this->form_validation->run() == true) {
$this->load->model('auth_model', 'auth');
......@@ -57,6 +57,53 @@ class User extends CI_Controller
}
public function valid_password($password = '')
{
$password = trim($password);
$regex_lowercase = '/[a-z]/';
$regex_uppercase = '/[A-Z]/';
$regex_number = '/[0-9]/';
$regex_special = '/[!@#$%^&*()\-_=+{};:,<.>§~]/';
if (empty($password))
{
$this->form_validation->set_message('valid_password', 'The {field} field is required.');
return FALSE;
}
if (preg_match_all($regex_lowercase, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least one lowercase letter.');
return FALSE;
}
if (preg_match_all($regex_uppercase, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least one uppercase letter.');
return FALSE;
}
if (preg_match_all($regex_number, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must have at least one number.');
return FALSE;
}
if (preg_match_all($regex_special, $password) < 1)
{
$this->form_validation->set_message('valid_password', 'The {field} field must have at least one special character.' . ' ' . htmlentities('!@#$%^&*()\-_=+{};:,<.>§~'));
return FALSE;
}
if (strlen($password) < 5)
{
$this->form_validation->set_message('valid_password', 'The {field} field must be at least 5 characters in length.');
return FALSE;
}
if (strlen($password) > 32)
{
$this->form_validation->set_message('valid_password', 'The {field} field cannot exceed 32 characters in length.');
return FALSE;
}
return TRUE;
}
......
......@@ -20,7 +20,7 @@
$allowAll['cart']['delete_product_from_cart']=true;
$allowAll['cart']['increase_qty']=true;
$allowAll['cart']['decrease_qty']=true;
$allowAll['auth']['registration_success']=true;
$allowAll['common']['unauthorized']=true;
......
......@@ -36,7 +36,7 @@ class Register_model extends CI_Model {
'protocol'=>'smtp',
'smtp_host'=>'ssl://smtp.googlemail.com',
'smtp_user'=>'tetianayaremko@gmail.com',
'smtp_pass'=>'****',
'smtp_pass'=>'*',
'smtp_port'=> '465',
'mailtype'=> 'html',
'charset'=> 'iso-8859-1',
......
......@@ -5,6 +5,7 @@
<meta charset="utf-8">
<link rel="stylesheet" href="<?php echo base_url(); ?>asset/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="<?php echo base_url(); ?>asset/css/user_style.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
......
......@@ -9,6 +9,9 @@
<div class="container">
<div class="header-wrapper">
<header class="header-section" >
<div class="shipping-offer">
<span>Free Spain Shipping on Orders of €50+ </span>
</div>
<div class="header-top">
<div class="logo">
<a href="<?php echo base_url(); ?>index.php/home/products"><img src="<?= asset_url('img/logo.png')?>" alt=""></a>
......
......@@ -36,6 +36,13 @@ div {
margin: 0 auto;
}
.shipping-offer {
background-color: #203229;
color: whitesmoke;
display: flex;
justify-content: center;
padding: 2px 0;
}
.header-top {
display: flex;
justify-content: space-between;
......@@ -102,11 +109,24 @@ div {
}
.navigation {
background-color: #f1f6f3;
background-color: #f1f6f3;
padding: 0;
display: flex;
justify-content: center;
text-align: center;
}
@media (max-width: 1150px) {
.navigation{
font-size: 0.8em;
}
}
@media (max-width: 950px) {
.navigation{
flex-wrap: wrap;
}
}
.navigation li {
display: inline;
......@@ -117,6 +137,12 @@ background-color: #f1f6f3;
}
@media (max-width: 950px) {
.navigation li{
height:10px;
}
}
.navigation a{
color: #444444;
}
......@@ -125,7 +151,7 @@ background-color: #f1f6f3;
/* home page*/
.head-offer {
margin-top: 170px;
margin-top: 200px;
background-color: #2D473A;
box-shadow: 5px 10px 8px #4c7762;
}
......@@ -137,6 +163,12 @@ background-color: #f1f6f3;
justify-content: space-around;
background-color: #2D473A;
}
@media (max-width: 950px) {
.offer{
font-size: 0.6em;
}
}
.offer a {
......@@ -197,10 +229,9 @@ background-color: #f1f6f3;
margin-left: 2rem;
}
.h_sec{
position: relative;
}
.section-header
{
......@@ -227,6 +258,12 @@ background-color: #f1f6f3;
background-color: white;
}
@media (max-width: 950px) {
.section-header{
font-size: 0.7em;
}
}
.shop-items {
display:grid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment