Commit fc9ff95a by Zen-PC\Zen

Merge branch 'integration' into kraikrit

# Conflicts:
#	www/src/Controller/ProfilesController.php
parents 1de13390 638cb0bb
<?php <?php
use Cake\Core\Configure;
/**
* ------------------------------------------------------------------------------------------------------------------
* Application Configure
* ------------------------------------------------------------------------------------------------------------------
*/
/**
*
* Database Configure
* @author sarawutt.b
*/
Configure::write('DATABASE.HOST', '122.155.223.38');
Configure::write('DATABASE.NAME', 'connect06');
Configure::write('DATABASE.ROLE', 'connect06');
Configure::write('DATABASE.PASSWORD', 'c0nn@6');
Configure::write('DATABASE.PORT', '5432');
Configure::write('DATABASE.DRIVER', 'Cake\Database\Driver\Postgres');
/**
* @var Connect API Testing server
*/
//Configure::write('API_SERVER', 'http://connect-api-uat-connect-pakgon');
/**
* @var Connect API Production Server
*/
Configure::write('API_SERVER', 'http://connect05.pakgon.com/api');
/**
* Core Currency format
* @author sarawutt.b
*/
Configure::write('CORE.CURRENCY', '฿');
/**
*
* Document type
* @author sarawutt.b
*/
Configure::write('CORE.DOCUMENT.ALL', 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,image/gif,image/jpeg,image/png');
Configure::write('CORE.DOCUMENT.IMG', 'image/gif,image/jpeg,image/png');
Configure::write('CORE.DOCUMENT.PDF', 'application/pdf');
Configure::write('CORE.DOCUMENT.OFFICE', 'application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel');
Configure::write('CORE.DOCUMENT.IMG_PDF', 'application/pdf,image/gif,image/jpeg,image/png');
Configure::write('CORE.DOCUMENT.OFFICE_PDF', 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel');
/**
* @var Configuration for multiple language
* @author sarawutt.b
*/
//Configure::write('Config.language', 'tha');
Configure::write('CORE.LANGUAGE', 'tha');
/**
* @var Configuration for pagination on cake render in paginate of each page
* @author sarawutt.b
*/
Configure::write('PAGINATION.PREV.TEXT', 'Prev');
Configure::write('PAGINATION.NEXT.TEXT', 'Next');
Configure::write('PAGINATION.NEXT.CLASS', 'next disabled');
Configure::write('PAGINATION.PREV.CLASS', 'prev disabled');
Configure::write('PAGINATION.MODULE', 9);
Configure::write('PAGINATION.SEPARATE', '');
Configure::write('PAGINATION.LIMIT', 20);
/**
*
* Application Configure
* @author sarawutt.b
*/
Configure::write('APP.NAME', 'CAKEPHP DEMO APPLICATION');
Configure::write('APP.VERSION', '3.5.4');
/**
* @var Configuration for production deployment if is deploy time make this to TRUE
* @author sarawutt.b
*/
Configure::write('APP.DEPLOY_TO_PRODUCTION_TIME', false);
/**
* @var Configuration not found data language
* @author sarawutt.b
*/
Configure::write('APP.DISPLAY.NO_RESULT', 'Result Not Found');
return [ return [
/** /**
* Debug Level: * Debug Level:
...@@ -10,7 +98,6 @@ return [ ...@@ -10,7 +98,6 @@ return [
* true: Errors and warnings shown. * true: Errors and warnings shown.
*/ */
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN), 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
/** /**
* Configure basic information about the application. * Configure basic information about the application.
* *
...@@ -55,7 +142,6 @@ return [ ...@@ -55,7 +142,6 @@ return [
'locales' => [APP . 'Locale' . DS], 'locales' => [APP . 'Locale' . DS],
], ],
], ],
/** /**
* Security and encryption configuration * Security and encryption configuration
* *
...@@ -66,7 +152,6 @@ return [ ...@@ -66,7 +152,6 @@ return [
'Security' => [ 'Security' => [
'salt' => env('SECURITY_SALT', '34f67849d2c770a24d70fcffa3c44f32fd532e338060fbeb5a9de575b4e4ea17'), 'salt' => env('SECURITY_SALT', '34f67849d2c770a24d70fcffa3c44f32fd532e338060fbeb5a9de575b4e4ea17'),
], ],
/** /**
* Apply timestamps with the last modified time to static assets (js, css, images). * Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified. * Will append a querystring parameter containing the time the file was modified.
...@@ -76,9 +161,8 @@ return [ ...@@ -76,9 +161,8 @@ return [
* enable timestamping regardless of debug value. * enable timestamping regardless of debug value.
*/ */
'Asset' => [ 'Asset' => [
// 'timestamp' => true, // 'timestamp' => true,
], ],
/** /**
* Configure the cache adapters. * Configure the cache adapters.
*/ */
...@@ -88,7 +172,6 @@ return [ ...@@ -88,7 +172,6 @@ return [
'path' => CACHE, 'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null), 'url' => env('CACHE_DEFAULT_URL', null),
], ],
/** /**
* Configure the cache used for general framework caching. * Configure the cache used for general framework caching.
* Translation cache files are stored with this configuration. * Translation cache files are stored with this configuration.
...@@ -103,7 +186,6 @@ return [ ...@@ -103,7 +186,6 @@ return [
'duration' => '+1 years', 'duration' => '+1 years',
'url' => env('CACHE_CAKECORE_URL', null), 'url' => env('CACHE_CAKECORE_URL', null),
], ],
/** /**
* Configure the cache for model and datasource caches. This cache * Configure the cache for model and datasource caches. This cache
* configuration is used to store schema descriptions, and table listings * configuration is used to store schema descriptions, and table listings
...@@ -119,7 +201,6 @@ return [ ...@@ -119,7 +201,6 @@ return [
'url' => env('CACHE_CAKEMODEL_URL', null), 'url' => env('CACHE_CAKEMODEL_URL', null),
], ],
], ],
/** /**
* Configure the Error and Exception handlers used by your application. * Configure the Error and Exception handlers used by your application.
* *
...@@ -156,7 +237,6 @@ return [ ...@@ -156,7 +237,6 @@ return [
'log' => true, 'log' => true,
'trace' => true, 'trace' => true,
], ],
/** /**
* Email configuration. * Email configuration.
* *
...@@ -189,8 +269,22 @@ return [ ...@@ -189,8 +269,22 @@ return [
'tls' => null, 'tls' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
], ],
'gmail'=> [
'className' => 'Smtp',
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'developer@pakgon.com', //your gmail address
'password' => 'pakgon#pwd', //your gmail password
'log' => true,
'context' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]
],
], ],
/** /**
* Email delivery profiles * Email delivery profiles
* *
...@@ -208,7 +302,6 @@ return [ ...@@ -208,7 +302,6 @@ return [
'headerCharset' => 'utf-8', 'headerCharset' => 'utf-8',
] ]
], ],
/** /**
* Connection information used by the ORM to connect * Connection information used by the ORM to connect
* to your application's datastores. * to your application's datastores.
...@@ -220,127 +313,75 @@ return [ ...@@ -220,127 +313,75 @@ return [
'Datasources' => [ 'Datasources' => [
'default' => [ 'default' => [
'className' => 'Cake\Database\Connection', 'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres', 'driver' => Configure::read('DATABASE.DRIVER'),
'persistent' => false, 'persistent' => false,
'host' => '122.155.223.38', 'host' => Configure::read('DATABASE.HOST'),
'port' => 5432, 'port' => Configure::read('DATABASE.PORT'),
/** 'username' => Configure::read('DATABASE.ROLE'),
* CakePHP will use the default DB port based on the driver selected 'password' => Configure::read('DATABASE.PASSWORD'),
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment 'database' => Configure::read('DATABASE.NAME'),
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
'username' => 'connect06',
'password' => 'c0nn@6',
'database' => 'connect06',
'encoding' => 'utf8',
'schema' => 'core', 'schema' => 'core',
'timezone' => 'UTC', 'encoding' => 'utf8',
'timezone' => Configure::read('CORE.DEFAULT_TIMEZONE'),
'flags' => [], 'flags' => [],
'cacheMetadata' => true, 'cacheMetadata' => true,
'log' => false, 'log' => false,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false, 'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null), 'url' => env('DATABASE_URL', null),
], ],
'core' => [ 'core' => [
'className' => 'Cake\Database\Connection', 'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres', 'driver' => Configure::read('DATABASE.DRIVER'),
'persistent' => false, 'persistent' => false,
'host' => '122.155.223.38', 'host' => Configure::read('DATABASE.HOST'),
'port' => 5432, 'port' => Configure::read('DATABASE.PORT'),
/** 'username' => Configure::read('DATABASE.ROLE'),
* CakePHP will use the default DB port based on the driver selected 'password' => Configure::read('DATABASE.PASSWORD'),
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment 'database' => Configure::read('DATABASE.NAME'),
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
'username' => 'connect06',
'password' => 'c0nn@6',
'database' => 'connect06',
'encoding' => 'utf8',
'schema' => 'core', 'schema' => 'core',
'timezone' => 'UTC', 'encoding' => 'utf8',
'timezone' => Configure::read('CORE.DEFAULT_TIMEZONE'),
'flags' => [], 'flags' => [],
'cacheMetadata' => true, 'cacheMetadata' => true,
'log' => false, 'log' => false,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false, 'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null), 'url' => env('DATABASE_URL', null),
], ],
'db_master' => [ 'db_master' => [
'className' => 'Cake\Database\Connection', 'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres', 'driver' => Configure::read('DATABASE.DRIVER'),
'persistent' => false, 'persistent' => false,
'host' => '122.155.223.38', 'host' => Configure::read('DATABASE.HOST'),
'port' => 5432, 'port' => Configure::read('DATABASE.PORT'),
//'port' => 'non_standard_port_number', 'username' => Configure::read('DATABASE.ROLE'),
'username' => 'connect06', 'password' => Configure::read('DATABASE.PASSWORD'),
'password' => 'c0nn@6', 'database' => Configure::read('DATABASE.NAME'),
'database' => 'connect06',
'encoding' => 'utf8',
'schema' => 'master', 'schema' => 'master',
'timezone' => 'UTC', 'encoding' => 'utf8',
'timezone' => Configure::read('CORE.DEFAULT_TIMEZONE'),
'flags' => [],
'cacheMetadata' => true, 'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false, 'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'quoteIdentifiers' => false,
'url' => env('DATABASE_TEST_URL', null), 'url' => env('DATABASE_URL', null),
], ],
'db_education' => [ 'db_education' => [
'className' => 'Cake\Database\Connection', 'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres', 'driver' => Configure::read('DATABASE.DRIVER'),
'persistent' => false, 'persistent' => false,
'host' => '122.155.223.38', 'host' => Configure::read('DATABASE.HOST'),
'port' => 5432, 'port' => Configure::read('DATABASE.PORT'),
//'port' => 'non_standard_port_number', 'username' => Configure::read('DATABASE.ROLE'),
'username' => 'connect06', 'password' => Configure::read('DATABASE.PASSWORD'),
'password' => 'c0nn@6', 'database' => Configure::read('DATABASE.NAME'),
'database' => 'connect06',
'encoding' => 'utf8',
'schema' => 'education', 'schema' => 'education',
'timezone' => 'UTC', 'encoding' => 'utf8',
'timezone' => Configure::read('CORE.DEFAULT_TIMEZONE'),
'flags' => [],
'cacheMetadata' => true, 'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false, 'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], 'quoteIdentifiers' => false,
'url' => env('DATABASE_TEST_URL', null), 'url' => env('DATABASE_URL', null),
], ],
/** /**
* The test connection is used during the test suite. * The test connection is used during the test suite.
...@@ -364,17 +405,16 @@ return [ ...@@ -364,17 +405,16 @@ return [
], ],
'db_temp' => [ 'db_temp' => [
'className' => 'Cake\Database\Connection', 'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres', 'driver' => Configure::read('DATABASE.DRIVER'),
'persistent' => false, 'persistent' => false,
'host' => '122.155.223.38', 'host' => Configure::read('DATABASE.HOST'),
'port' => '5432', 'port' => Configure::read('DATABASE.PORT'),
//'port' => 'non_standard_port_number', 'username' => Configure::read('DATABASE.ROLE'),
'username' => 'connect06', 'password' => Configure::read('DATABASE.PASSWORD'),
'password' => 'c0nn@6', 'database' => Configure::read('DATABASE.NAME'),
'database' => 'connect06',
'encoding' => 'utf8', 'encoding' => 'utf8',
'schema' => 'temp', 'schema' => 'temp',
'timezone' => 'UTC', 'timezone' => Configure::read('CORE.DEFAULT_TIMEZONE'),
'cacheMetadata' => true, 'cacheMetadata' => true,
'quoteIdentifiers' => false, 'quoteIdentifiers' => false,
'log' => false, 'log' => false,
...@@ -382,7 +422,6 @@ return [ ...@@ -382,7 +422,6 @@ return [
'url' => env('DATABASE_TEST_URL', null), 'url' => env('DATABASE_TEST_URL', null),
], ],
], ],
/** /**
* Configures logging options * Configures logging options
*/ */
...@@ -402,7 +441,6 @@ return [ ...@@ -402,7 +441,6 @@ return [
'url' => env('LOG_ERROR_URL', null), 'url' => env('LOG_ERROR_URL', null),
], ],
], ],
/** /**
* Session configuration. * Session configuration.
* *
...@@ -444,32 +482,70 @@ return [ ...@@ -444,32 +482,70 @@ return [
*/ */
'Session' => [ 'Session' => [
'defaults' => 'php', 'defaults' => 'php',
'ini' => [
'session.cookie_path' => '/',
'session.cookie_domain' => '.pakgon.com'
]
],
'OAuth2Client' => [
'routes' => [
'base_uri' => 'http://oauth-uat.connect.pakgon.com',
'access_token_path' => '/oauth',
'refresh_token_path' => '/oauth/access_token',
],
'keys' => [
'client_id' => 'NWFmYTdjYzA3OTI4M2Jj',
'client_secret' => '2cf5e8f82bfaa9971e8af9ed06c23d94ef1326ba'
]
],
'Muffin/OAuth2', [
'providers' => [
'generic' => [
'className' => 'League\OAuth2\Client\Provider\GenericProvider',
// all options defined here are passed to the provider's constructor
'options' => [
'clientId' => 'NWFmYTdjYzA3OTI4M2Jj',
'clientSecret' => '2cf5e8f82bfaa9971e8af9ed06c23d94ef1326ba',
],
'mapFields' => [
'username' => 'login', // maps the app's username to github's login
],
// ... add here the usual AuthComponent configuration if needed like fields, etc.
],
],
],
'OAUTH2_PROVIDER' => [
'URL' => 'http://oauth-uat.connect.pakgon.com',
'CLIENT_ID' => 'NWFmYTdjYzA3OTI4M2Jj',
'CLIENT_SECRET' => '2cf5e8f82bfaa9971e8af9ed06c23d94ef1326ba',
'REDIRECT_URI' => 'http://commu-uat.connect.pakgon.com/home/callback',
'ACCESS_TOKEN_URL' => 'http://oauth-uat.connect.pakgon.com/oauth/access_token.json',
'REFRESH_TOKEN_URL' => 'xxx'
], ],
'Config' => [ 'Config' => [
'apiCore' => [ 'apiCore' => [
'createAccount' => 'http://connect05.pakgon.com/api/Signups', //Signup 'createAccount' => Configure::read('API_SERVER') . '/Signups', //Signup
'verifyPinCode' => 'http://connect05.pakgon.com/api/Signups/verify', //PicCode 'verifyPinCode' => Configure::read('API_SERVER') . '/Signups/verify', //PicCode
'signin' => 'http://connect05.pakgon.com/api/Signins', //Signin 'signin' => Configure::read('API_SERVER') . '/Signins', //Signin
'changePassword' => Configure::read('API_SERVER') . '/Profiles/changePassword', //ChangePassword
'changePassword' => 'http://connect05.pakgon.com/api/Profiles/changePassword', //ChangePassword 'forgotPassword' => Configure::read('API_SERVER') . '/Profiles/forgetPassword', //ForgotPassword
'forgotPassword' => 'http://connect05.pakgon.com/api/Profiles/forgetPassword', //ForgotPassword 'profile' => Configure::read('API_SERVER') . '/Profiles', //Profile
'profile' => 'http://connect05.pakgon.com/api/Profiles', //Profile 'connectProfile' => Configure::read('API_SERVER') . '/Connects/profile', //Profile
'connectProfile' => 'http://connect05.pakgon.com/api/Connects/profile',//Profile 'Contact' => Configure::read('API_SERVER') . '/Contacts', //Contacts
'Contact' => 'http://connect05.pakgon.com/api/Contacts',//Contacts
], ],
'apiCommunication' => [ 'apiCommunication' => [
'getCategoriesHome' => 'http://connect05.pakgon.com/communication/Api/getCategoriesHome.json', 'getCategoriesHome' => Configure::read('API_SERVER') . '/communication/Api/getCategoriesHome.json',
'getNewsHome' => 'http://connect05.pakgon.com/communication/Api/getNewsHome.json', 'getNewsHome' => Configure::read('API_SERVER') . '/communication/Api/getNewsHome.json',
'getNotification' => 'http://connect05.pakgon.com/api/Notifications/push', 'getNotification' => Configure::read('API_SERVER') . '/Notifications/push',
'getNotificationType' => 'http://connect05.pakgon.com/communication/Api/getNotificationType.json', 'getNotificationType' => Configure::read('API_SERVER') . '/communication/Api/getNotificationType.json',
'getNotificationMessage' => 'http://connect05.pakgon.com/communication/Api/getNotificationMessage.json', 'getNotificationMessage' => Configure::read('API_SERVER') . '/communication/Api/getNotificationMessage.json',
'updateReadStatus' => 'http://connect05.pakgon.com/communication/Api/updateReadStatus.json', 'updateReadStatus' => Configure::read('API_SERVER') . '/communication/Api/updateReadStatus.json',
'setNotificationMessage' => 'http://connect05.pakgon.com/communication/Api/setNotificationMessage.json', 'setNotificationMessage' => Configure::read('API_SERVER') . '/communication/Api/setNotificationMessage.json',
'getNewsDetail' => 'http://connect05.pakgon.com/communication/Api/getNewsDetail.json', 'getNewsDetail' => Configure::read('API_SERVER') . '/communication/Api/getNewsDetail.json',
'notification' => 'http://connect05.pakgon.com/communication/Api/getNotificationType.json', 'notification' => Configure::read('API_SERVER') . '/communication/Api/getNotificationType.json',
] ]
]
],
'RedirectApplicationURL' => 'http://commu-uat.connect.pakgon.com'
]; ];
...@@ -217,3 +217,4 @@ if (Configure::read('debug')) { ...@@ -217,3 +217,4 @@ if (Configure::read('debug')) {
//Plugin::load('AdminLTE', ['bootstrap' => true, 'routes' => true]); //Plugin::load('AdminLTE', ['bootstrap' => true, 'routes' => true]);
//Plugin::load('Porto',['bootstrap' => true,'routes' => true ]); //Plugin::load('Porto',['bootstrap' => true,'routes' => true ]);
} }
Plugin::load('Muffin/OAuth2');
\ No newline at end of file
...@@ -49,12 +49,16 @@ Router::scope('/', function (RouteBuilder $routes) { ...@@ -49,12 +49,16 @@ Router::scope('/', function (RouteBuilder $routes) {
* its action called 'display', and we pass a param to select the view file * its action called 'display', and we pass a param to select the view file
* to use (in this case, src/Template/Pages/home.ctp)... * to use (in this case, src/Template/Pages/home.ctp)...
*/ */
$routes->connect('/', ['controller' => 'Users', 'action' => 'signin']); // $routes->connect('/', ['controller' => 'Users', 'action' => 'signin']);
$routes->connect('/', ['controller' => 'homes', 'action' => 'index']);
/** /**
* ...and connect the rest of 'Pages' controller's URLs. * ...and connect the rest of 'Pages' controller's URLs.
*/ */
////$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']); $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
//Adding by sarawutt.b for oauth2 authenticatio
//$routes->connect('/oauth/:provider', ['controller' => 'users', 'action' => 'login'], ['provider' => 'generic']);
$routes->setExtensions(['json', 'xml', 'html']);
/** /**
* Connect catchall routes for all controllers. * Connect catchall routes for all controllers.
......
<?php <?php
/** /**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org) * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
...@@ -12,10 +13,13 @@ ...@@ -12,10 +13,13 @@
* @since 0.2.9 * @since 0.2.9
* @license https://opensource.org/licenses/mit-license.php MIT License * @license https://opensource.org/licenses/mit-license.php MIT License
*/ */
namespace App\Controller; namespace App\Controller;
use Cake\Controller\Controller; use Cake\Controller\Controller;
use Cake\Event\Event; use Cake\Event\Event;
use Cake\I18n\I18n;
use Cake\Core\Configure;
/** /**
* Application Controller * Application Controller
...@@ -25,8 +29,9 @@ use Cake\Event\Event; ...@@ -25,8 +29,9 @@ use Cake\Event\Event;
* *
* @link https://book.cakephp.org/3.0/en/controllers.html#the-app-controller * @link https://book.cakephp.org/3.0/en/controllers.html#the-app-controller
*/ */
class AppController extends Controller class AppController extends Controller {
{
protected $selectEmptyMsg = '---- please select ----';
/** /**
* Initialization hook method. * Initialization hook method.
...@@ -37,8 +42,7 @@ class AppController extends Controller ...@@ -37,8 +42,7 @@ class AppController extends Controller
* *
* @return void * @return void
*/ */
public function initialize() public function initialize() {
{
parent::initialize(); parent::initialize();
//$this->viewBuilder()->theme('Porto'); //$this->viewBuilder()->theme('Porto');
$this->loadComponent('RequestHandler'); $this->loadComponent('RequestHandler');
...@@ -48,42 +52,193 @@ class AppController extends Controller ...@@ -48,42 +52,193 @@ class AppController extends Controller
* Enable the following components for recommended CakePHP security settings. * Enable the following components for recommended CakePHP security settings.
* see https://book.cakephp.org/3.0/en/controllers/components/security.html * see https://book.cakephp.org/3.0/en/controllers/components/security.html
*/ */
$this->loadComponent('Auth', [
'loginRedirect' => ['controller' => 'Homes', 'action' => 'index'],
'logoutRedirect' => ['controller' => 'Users', 'action' => 'signin'],
'authenticate' => [
'Form' => [
'fields' => ['username' => 'username', 'password' => 'password'],
'userModel' => 'Users'
]
],
'loginAction' => ['controller' => 'Users', 'action' => 'signin'],
'authorize' => ['Controller'],
'unauthorizedRedirect' => $this->referer()// If unauthorized, return them to page they were just on
]);
//$this->loadComponent('Security'); //$this->loadComponent('Security');
//$this->loadComponent('Csrf'); //$this->loadComponent('Csrf');
} }
/** /**
*
* Function trigger before filter process
* @author sarawutt.b
* @param Event $event
*/
public function beforeFilter(Event $event) {
parent::beforeFilter($event);
/**
*
* Set appication language this can be thai|english
* @author Sarawutt.b
* @since 2018-02-28
* @return void
*/
if ($this->request->session()->check('SessionLanguage') == false) {
$this->request->session()->write('SessionLanguage', 'tha');
}
$this->Auth->allow(['signin', 'signout', 'signup', 'verify']);
}
/**
* Before render callback. * Before render callback.
* *
* @param \Cake\Event\Event $event The beforeRender event. * @param \Cake\Event\Event $event The beforeRender event.
* @return \Cake\Http\Response|null|void * @return \Cake\Http\Response|null|void
*/ */
public function beforeRender(Event $event) public function beforeRender(Event $event) {
{
//$this->viewBuilder()->theme('Gentelella'); //$this->viewBuilder()->theme('Gentelella');
//$this->viewBuilder()->theme('AdminLTE'); //$this->viewBuilder()->theme('AdminLTE');
//$this->viewBuilder()->theme('Porto'); //$this->viewBuilder()->theme('Porto');
//$this->viewBuilder()->className('AdminLTE.AdminLTE'); //$this->viewBuilder()->className('AdminLTE.AdminLTE');
//$this->viewBuilder()->theme('Porto'); //$this->viewBuilder()->theme('Porto');
//$this->viewBuilder()->className('Porto.Porto'); //$this->viewBuilder()->className('Porto.Porto');
// Note: These defaults are just to get started quickly with development // Note: These defaults are just to get started quickly with development
// and should not be used in production. You should instead set "_serialize" // and should not be used in production. You should instead set "_serialize"
// in each action as required. // in each action as required.
if (!array_key_exists('_serialize', $this->viewVars) && if (!array_key_exists('_serialize', $this->viewVars) &&
in_array($this->response->type(), ['application/json', 'application/xml']) in_array($this->response->type(), ['application/json', 'application/xml'])
) { ) {
$this->set('_serialize', true); $this->set('_serialize', true);
//$this->set('theme', Configure::read('Theme')); //$this->set('theme', Configure::read('Theme'));
} }
//$this->set('theme', Configure::read('Theme')); //$this->set('theme', Configure::read('Theme'));
} }
function checkToken(){
if(empty($this->request->getHeaderLine('Authorization'))){ /**
return $this->redirect(['controller' => 'Users', 'action' => 'signin']); *
} * Function check authorize
* @author sarawutt.b
* @param type $user
* @return boolean
*/
public function isAuthorized($user) {
return true;
}
/**
*
* Function check fore token
* @return type
*/
function checkToken() {
if (empty($this->request->getHeaderLine('Authorization'))) {
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}
}
/**
* Set language used this in mutiple language application concept
* @author Sarawutt.b
* @since 2016/03/21 10:23:33
* @return void
*/
public function _setLanguage() {
$this->L10n = new L10n();
$language = $this->request->session()->read('SessionLanguage');
Configure::write('Config.language', $language);
$this->L10n->get($language);
}
/**
*
* Function get for current session user language
* @author sarawutt.b
* @return string
*/
public function getCurrentLanguage() {
return $this->request->session()->read('SessionLanguage');
} }
/**
*
* Function used fro generate _VERSION_
* @author sarawutt.b
* @return biginteger of the version number
*/
public function VERSION() {
$parts = explode(' ', microtime());
$micro = $parts[0] * 1000000;
return(substr(date('YmdHis'), 2) . sprintf("%06d", $micro));
}
/**
*
* Function used for generate UUID key patern
* @author sarawutt.b
* @return string uuid in version
*/
public function UUID() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
/**
*
* Function get for current session user authentication full name
* @author sarawutt.b
* @since 2018/02/06
* @return string of authentication user full name
*/
protected function getAuthFullname() {
return $this->readAuth('Auth.User.first_name') . ' ' . $this->readAuth('Auth.User.last_name');
}
/**
*
* Function get for current session user authentication user id
* @author sarawutt.b
* @since 2018/02/06
* @return string of authentication user id
*/
protected function getAuthUserId() {
return $this->readAuth('Auth.User.id');
}
/**
*
* Function get for current session user authentication role id
* @author sarawutt.b
* @since 2018/02/06
* @return string of authentication user id
*/
protected function getAuthUserRoleId() {
return $this->readAuth('Auth.User.role_id');
}
/**
*
* Function get for current session with user authentication
* @author sarawutt.b
* @since 2018/02/06
* @return string of authentication session info
*/
protected function readAuth($name = null) {
return $this->request->session()->read($name);
}
/**
* Function get for empty option in DDL
* @author sarawutt.b
* @return array() of empty select DDL
*/
public function getEmptySelect() {
return ['' => __($this->selectEmptyMsg)];
}
} }
...@@ -14,6 +14,8 @@ class ProfilesController extends AppController ...@@ -14,6 +14,8 @@ class ProfilesController extends AppController
/*******************************/ /*******************************/
$id = $this->Auth->user('id');
$this->loadModel('Users'); $this->loadModel('Users');
$responseUserProfile = $this->Users->get($id, [ $responseUserProfile = $this->Users->get($id, [
'contain' => [] 'contain' => []
...@@ -35,7 +37,6 @@ class ProfilesController extends AppController ...@@ -35,7 +37,6 @@ class ProfilesController extends AppController
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'country_name_th' 'valueField' => 'country_name_th'
]); ]);
// pr($responseUserPersonal['master_country_id']);die;
if(!empty($Country)) $Country = $Country->toArray(); if(!empty($Country)) $Country = $Country->toArray();
//********DropdownProvince******** //********DropdownProvince********
...@@ -45,7 +46,9 @@ class ProfilesController extends AppController ...@@ -45,7 +46,9 @@ class ProfilesController extends AppController
'is_used' => true], 'is_used' => true],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
])->where(['master_country_id =' => $responseUserPersonal['master_country_id']]); ])
->where(['master_country_id =' => $responseUserPersonal['master_country_id']])
->order(['province_name_th']);
// pr($Province);die; // pr($Province);die;
if(!empty($Province)) $Province = $Province->toArray(); if(!empty($Province)) $Province = $Province->toArray();
...@@ -65,7 +68,7 @@ class ProfilesController extends AppController ...@@ -65,7 +68,7 @@ class ProfilesController extends AppController
] ]
] ]
)->first(); )->first();
// pr($userPersonals);die;
if($userPersonals['email'] == $this->request->data['UserPersonals']['email']){ if($userPersonals['email'] == $this->request->data['UserPersonals']['email']){
$chkemail = true; $chkemail = true;
}else{ }else{
...@@ -87,18 +90,18 @@ class ProfilesController extends AppController ...@@ -87,18 +90,18 @@ class ProfilesController extends AppController
if($chkemail == true){ if($chkemail == true){
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']); $birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0]; $birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
$userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']); $userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th']; $userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th']; $userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th'];
$userPersonals['email'] = $this->request->data['UserPersonals']['email']; $userPersonals['email'] = $this->request->data['UserPersonals']['email'];
$userPersonals['birthdate'] = $birthdate; $userPersonals['birthdate'] = $birthdate;
$userPersonals['user_id'] = $data['Users']['user_id']; $userPersonals['user_id'] = $data['Users']['user_id'];
$userPersonals['master_country_id'] = $this->request->data['master_country_id']; $userPersonals['master_country_id'] = $this->request->data['master_country_id'];
$userPersonals['master_province_id'] = $this->request->data['master_province_id']; $userPersonals['master_province_id'] = $this->request->data['master_province_id'];
$userPersonals['modified_by'] = ''; $userPersonals['modified_by'] = $id;
if ($this->UserPersonals->save($userPersonals)) { if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('Update Complete.')); $this->Flash->success(__('Update Complete.'));
...@@ -594,4 +597,5 @@ if (!empty($SubjectEnrolls)) { ...@@ -594,4 +597,5 @@ if (!empty($SubjectEnrolls)) {
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
} }
...@@ -3,7 +3,11 @@ namespace App\Controller; ...@@ -3,7 +3,11 @@ namespace App\Controller;
use App\Controller\AppController; use App\Controller\AppController;
class ProvincesController extends AppController class ProvincesController extends AppController
{ {
public function initialize() {
parent::initialize();
$this->Auth->allow();
}
public function getProvince() { public function getProvince() {
$this->autoRender = false; $this->autoRender = false;
......
...@@ -10,82 +10,91 @@ use Cake\Mailer\Email; ...@@ -10,82 +10,91 @@ use Cake\Mailer\Email;
use Cake\Utility\Security; use Cake\Utility\Security;
use Cake\Auth\AbstractPasswordHasher; use Cake\Auth\AbstractPasswordHasher;
class UsersController extends AppController class UsersController extends AppController {
{
/**
*
* Function initialize make for automatically trigger when contructure
*/
public function initialize() {
parent::initialize();
$this->Auth->allow(['signin', 'signout', 'signup', 'verify','forgotPassword','createAccount','pinCode','pinCodepassword']);
}
public function index() public function index() {
{ return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
} }
public function signin() public function signin() {
{
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
#Signin #Signin
public function verify()
{
$this->viewBuilder()->layout('blank');
$data = $this->request->data(); public function verify() {
#$data['data']['ip'] = $this->request->clientIp(); $this->viewBuilder()->layout('blank');
if(!empty($data)){ if ($this->request->is('post')) {
if(!empty($data['data']['username']) && !empty($data['data']['password'])){ $data = $this->request->getData();
$data['data']['ip'] = $this->request->clientIp();#prr($data); if (!empty($data)) {
$data['data']['ip'] = $this->request->clientIp();
$api_core_signin = Configure::read('Config.apiCore.signin'); $api_core_signin = Configure::read('Config.apiCore.signin');
$http = new Client(); $http = new Client();
$response = $http->post($api_core_signin,$data['data'])->body(); $response = $http->post($api_core_signin, $data['data'])->body();
$response = json_decode($response,'_full');#prd($response); $response = json_decode($response, '_full');
if(!empty($response)){ if (!empty($response)) {
if(trim($response['status']) == 'Success'){ if (strtolower(trim($response['status'])) == 'success') {
$url = Router::url(['controller' => 'Homes', 'action' => 'index'], true); $response['result']['user']['id'] = $response['result']['user']['user_id'];
$this->Auth->setUser($response['result']['user']);
echo "<script>setTimeout(function(){Login.onLogin('".$response['result']['token']."','".$url."','".$response['result']['topic']."')},1000);</script>"; //$url = Router::url(['controller' => 'Homes', 'action' => 'index'], true);
#echo "<script>setTimeout(function(){alert('".$response['result']['token']."')},1000);</script>"; // Before chan logic to OAUTH
#echo "<script>Login.onLogin('".$response['result']['token']."','".$url."','".$response['result']['topic']."');</script>"; // echo "<script>setTimeout(function(){Login.onLogin('" . $response['result']['token'] . "','" . $url . "','" . $response['result']['topic'] . "')},1000);</script>";
#echo "<button onclick=Login.onLogin('".$response['result']['token']."','".$url."','".$response['result']['topic']."')>CLICK</button>";
$statusCode = '200';
#------------------------------------------------------------------
$param = []; // echo "<script type='text/javascript'>setTimeout(function(){Login.onLogin('" . $statusCode . "','" . $this->_redirectApplicationURL . "','" . $response['result']['topic'] . "')},1000);</script>";
$param['topic'] = '/topics/'.$response['result']['topic']; $redirectApplicationURL = Configure::read('RedirectApplicationURL');
$param['title'] = '';
$param['message'] = ''; $topic = $response['result']['topic'];
$param['badge'] = 1; $this->set(compact('statusCode', 'redirectApplicationURL', 'topic'));
#$api_notification = 'http://connect05.pakgon.com/api/Notifications/push'; #echo "<script>setTimeout(function(){alert('".$response['result']['token']."')},1000);</script>";
$api_notification = Configure::read('Config.apiCommunication.getNotification'); #echo "<script>Login.onLogin('".$response['result']['token']."','".$url."','".$response['result']['topic']."');</script>";
#echo "<button onclick=Login.onLogin('".$response['result']['token']."','".$url."','".$response['result']['topic']."')>CLICK</button>";
$http = new Client(); #------------------------------------------------------------------
$options = [ $param = [];
'headers' => [ $param['topic'] = '/topics/' . $response['result']['topic'];
'Content-Type' => 'application/x-www-form-urlencoded', $param['title'] = '';
] $param['message'] = '';
]; $param['badge'] = 1;
$response = $http->post($api_notification, $param, $options)->body();
#prr($response); #$api_notification = 'http://connect05.pakgon.com/api/Notifications/push';
#------------------------------------------------------------------ $api_notification = Configure::read('Config.apiCommunication.getNotification');
$http = new Client();
die; $options = [
'headers' => [
}else{ 'Content-Type' => 'application/x-www-form-urlencoded',
$this->Flash->error(__('Verify Fail')); ]
return $this->redirect(['controller' => 'Users', 'action' => 'signin']); ];
} $response = $http->post($api_notification, $param, $options)->body();
}else{ #prr($response);
$this->Flash->error(__('Verify Fail')); #------------------------------------------------------------------
return $this->redirect(['controller' => 'Users', 'action' => 'signin']); //$this->redirect($this->_redirectApplicationURL);
} //header('Location: ' . $this->_redirectApplicationURL);
} else {
}else{ $this->Flash->error(__('Verify Fail'));
$this->Flash->error(__('Data Empty')); return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
return $this->redirect(['controller' => 'Users', 'action' => 'signin']); }
} } else {
$this->Flash->error(__('Verify Fail'));
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}
} else {
$this->Flash->error(__('Data Empty'));
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}
} }
} }
public function signup() public function signup()
...@@ -113,7 +122,7 @@ class UsersController extends AppController ...@@ -113,7 +122,7 @@ class UsersController extends AppController
$this->set(compact('provinces','countries')); $this->set(compact('provinces','countries'));
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
...@@ -151,7 +160,7 @@ class UsersController extends AppController ...@@ -151,7 +160,7 @@ class UsersController extends AppController
$this->request->data['password'] = $hasher->hash($password); $this->request->data['password'] = $hasher->hash($password);
$users['created_by'] = 0; $users['created_by'] = 0;
$users['is_used'] = true; $users['is_used'] = false;
$users['created'] = $dateNow; $users['created'] = $dateNow;
$users['dynamic_key'] = 'dynamic_key'; $users['dynamic_key'] = 'dynamic_key';
...@@ -182,10 +191,10 @@ class UsersController extends AppController ...@@ -182,10 +191,10 @@ class UsersController extends AppController
// pr($users);die; // pr($users);die;
//------------------------------ ส่งอีเมล์ ----------------------------------------------------- //------------------------------ ส่งอีเมล์ -----------------------------------------------------
// $data_notification = []; $data_notification = [];
// $data_notification['email'] = $this->request->data['email']; $data_notification['email'] = $this->request->data['email'];
// $data_notification['pin_code'] = $users['pin_code']; $data_notification['pin_code'] = $users['pin_code'];
// $this->notification($data_notification); $this->notification($data_notification);
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
$this->Users->save($users); $this->Users->save($users);
$user_personals['master_country_id'] = $master_country_id; $user_personals['master_country_id'] = $master_country_id;
...@@ -245,19 +254,17 @@ class UsersController extends AppController ...@@ -245,19 +254,17 @@ class UsersController extends AppController
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
function validateAccount($data = null) function validateAccount($data = null) {
{
$error = [];
$error = [];
if (!empty($error)) {
if(!empty($error)){ $this->set('error', $error);
$this->set('error',$error); return false;
return false; } else {
}else{ return true;
return true; }
}
} }
// public function notification() // public function notification()
...@@ -269,7 +276,7 @@ class UsersController extends AppController ...@@ -269,7 +276,7 @@ class UsersController extends AppController
public function pinCode($token=null) public function pinCode($token=null)
{ {
if(empty($token))
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
...@@ -318,22 +325,23 @@ class UsersController extends AppController ...@@ -318,22 +325,23 @@ class UsersController extends AppController
// $pass[] = $alphabet[$n]; // $pass[] = $alphabet[$n];
// } // }
// $password = implode($pass); // $password = implode($pass);
//--------------------ตัวส่ง Email --------------------------------------
//pr($user_personals);die;
// $data_notification = [];
// $data_notification['email'] = $this->request->data['email'];
// $data_notification['password'] = $password;
// $this->notification($data_notification);
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
// $users['password'] = $hasher->hash($password);
$user_personals = $this->UserPersonals->find('all',[ $user_personals = $this->UserPersonals->find('all',[
'conditions' => [ 'conditions' => [
'UserPersonals.email' => $email 'UserPersonals.email' => $email
] ]
])->first(); ])->first();
if(!empty($user_personals)){ if(!empty($user_personals)){
//--------------------ตัวส่ง Email ---------------------------------------------------------
// pr($user_personals);die;
// $data_notification = [];
// $data_notification['email'] = $this->request->data['email'];
// $data_notification['pin_code'] = $users['pin_pass'];
// $this->notification($data_notification);
//----------------------------------------------------------------------------------------
$users = $this->Users->find('all',[ $users = $this->Users->find('all',[
'conditions' => [ 'conditions' => [
'Users.id' => $user_personals['user_id'] 'Users.id' => $user_personals['user_id']
...@@ -342,10 +350,15 @@ class UsersController extends AppController ...@@ -342,10 +350,15 @@ class UsersController extends AppController
$digits = 4; $digits = 4;
$users['pin_pass'] = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT); $users['pin_pass'] = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);
$token = $users['token']; $token = $users['token'];
// pr($users);die;
// $users = $this->Users->patchEntity($users, $this->request->getData()); //--------------------ตัวส่ง Email ---------------------------------------------------------
//pr($user_personals);die;
$data_notification = [];
$data_notification['email'] = $this->request->data['email'];
$data_notification['pin_code'] = $users['pin_pass'];
$this->notification($data_notification);
//----------------------------------------------------------------------------------------
$this->Users->save($users); $this->Users->save($users);
// pr($users);die;
$this->Flash->success(__('send password to email success')); $this->Flash->success(__('send password to email success'));
return $this->redirect(['action' => 'pinCodepassword/'.$token]); return $this->redirect(['action' => 'pinCodepassword/'.$token]);
...@@ -414,4 +427,8 @@ class UsersController extends AppController ...@@ -414,4 +427,8 @@ class UsersController extends AppController
$this->checkToken(); $this->checkToken();
} }
} }
<table cellpadding="0" width="100%" cellspacing="0" border="0" id="backgroundTable" class='bgBody'>
<tr>
<td>
<table cellpadding="0" width="620" class="container" align="center" cellspacing="0" border="0">
<tr>
<td>
<!-- Tables are the most common way to format your email consistently. Set your table widths inside cells and in most cases reset cellpadding, cellspacing, and border to zero. Use nested tables as a way to space effectively in your message. -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td class='movableContentContainer bgItem'>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr height="40">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="200" valign="top">&nbsp;</td>
<td width="200" valign="top" align="center">
<div class="contentEditableContainer contentImageEditable">
<div class="contentEditable" align='center' >
<img src="images/logo.png" width="155" height="155" alt='Logo' data-default="placeholder" />
</div>
</div>
</td>
<td width="200" valign="top">&nbsp;</td>
</tr>
<tr height="25">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="100%" colspan="3" align="center" style="padding-bottom:10px;padding-top:25px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<h2 >It's been a while...</h2>
</div>
</div>
</td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="400" align="center">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<p >Hi [FirstName,there],
<br/>
<br/>
Click on the link below to update your profile. If you're no longer interested in hearing from us, simply click on unsubscribe below (or ignore this message) and we won't send you any more newsletters.</p>
</div>
</div>
</td>
<td width="100">&nbsp;</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="200">&nbsp;</td>
<td width="200" align="center" style="padding-top:25px;">
<table cellpadding="0" cellspacing="0" border="0" align="center" width="200" height="50">
<tr>
<td bgcolor="#ED006F" align="center" style="border-radius:4px;" width="200" height="50">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<a target='_blank' href="#" class='link2'>Click here to reset it</a>
</div>
</div>
</td>
</tr>
</table>
</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="100%" colspan="2" style="padding-top:65px;">
<hr style="height:1px;border:none;color:#333;background-color:#ddd;" />
</td>
</tr>
<tr>
<td width="60%" height="70" valign="middle" style="padding-bottom:20px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">Sent to [email] by [CLIENTS.COMPANY_NAME]</span>
<br/>
<span style="font-size:11px;color:#555;font-family:Helvetica, Arial, sans-serif;line-height:200%;">[CLIENTS.ADDRESS] | [CLIENTS.PHONE]</span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
<a target='_blank' href="[FORWARD]" style="text-decoration:none;color:#555">Forward to a friend</a>
</span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
<a target='_blank' href="[UNSUBSCRIBE]" style="text-decoration:none;color:#555">click here to unsubscribe</a></span>
</div>
</div>
</td>
<td width="40%" height="70" align="right" valign="top" align='right' style="padding-bottom:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align='right'>
<tr>
<td width='57%'></td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentFacebookEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="images/facebook.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='facebook' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentTwitterEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="images/twitter.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='twitter' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentImageEditable" style='display:inline;'>
<div class="contentEditable" >
<a target='_blank' href="#" data-default="placeholder" style="text-decoration:none;">
<img src="images/pinterest.png" width="30" height="30" data-max-width="30" alt='pinterest' style='margin-right:40x;' />
</a>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
\ No newline at end of file
<table cellpadding="0" width="100%" cellspacing="0" border="0" id="backgroundTable" class='bgBody'>
<tr>
<td>
<table cellpadding="0" width="620" class="container" align="center" cellspacing="0" border="0">
<tr>
<td>
<!-- Tables are the most common way to format your email consistently. Set your table widths inside cells and in most cases reset cellpadding, cellspacing, and border to zero. Use nested tables as a way to space effectively in your message. -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td class='movableContentContainer bgItem'>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr height="40">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="200" valign="top">&nbsp;</td>
<td width="200" valign="top" align="center">
<div class="contentEditableContainer contentImageEditable">
<div class="contentEditable" align='center' >
<img src="images/logo.png" width="155" height="155" alt='Logo' data-default="placeholder" />
</div>
</div>
</td>
<td width="200" valign="top">&nbsp;</td>
</tr>
<tr height="25">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="100%" colspan="3" align="center" style="padding-bottom:10px;padding-top:25px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<h2 >It's been a while...</h2>
</div>
</div>
</td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="400" align="center">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<p >Hi [FirstName,there],
<br/>
<br/>
Click on the link below to update your profile. If you're no longer interested in hearing from us, simply click on unsubscribe below (or ignore this message) and we won't send you any more newsletters.</p>
</div>
</div>
</td>
<td width="100">&nbsp;</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="200">&nbsp;</td>
<td width="200" align="center" style="padding-top:25px;">
<table cellpadding="0" cellspacing="0" border="0" align="center" width="200" height="50">
<tr>
<td bgcolor="#ED006F" align="center" style="border-radius:4px;" width="200" height="50">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<a target='_blank' href="#" class='link2'>Click here to reset it</a>
</div>
</div>
</td>
</tr>
</table>
</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="100%" colspan="2" style="padding-top:65px;">
<hr style="height:1px;border:none;color:#333;background-color:#ddd;" />
</td>
</tr>
<tr>
<td width="60%" height="70" valign="middle" style="padding-bottom:20px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">Sent to [email] by [CLIENTS.COMPANY_NAME]</span>
<br/>
<span style="font-size:11px;color:#555;font-family:Helvetica, Arial, sans-serif;line-height:200%;">[CLIENTS.ADDRESS] | [CLIENTS.PHONE]</span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
<a target='_blank' href="[FORWARD]" style="text-decoration:none;color:#555">Forward to a friend</a>
</span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
<a target='_blank' href="[UNSUBSCRIBE]" style="text-decoration:none;color:#555">click here to unsubscribe</a></span>
</div>
</div>
</td>
<td width="40%" height="70" align="right" valign="top" align='right' style="padding-bottom:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align='right'>
<tr>
<td width='57%'></td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentFacebookEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="images/facebook.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='facebook' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentTwitterEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="images/twitter.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='twitter' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentImageEditable" style='display:inline;'>
<div class="contentEditable" >
<a target='_blank' href="#" data-default="placeholder" style="text-decoration:none;">
<img src="images/pinterest.png" width="30" height="30" data-max-width="30" alt='pinterest' style='margin-right:40x;' />
</a>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
\ No newline at end of file
<table cellpadding="0" width="100%" cellspacing="0" border="0" id="backgroundTable" class='bgBody'>
<tr>
<td>
<table cellpadding="0" width="620" class="container" align="center" cellspacing="0" border="0">
<tr>
<td>
Verification code: <?php echo $verify_code;?>
</td>
</tr>
</table>
</td>
</tr>
</table>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>[SUBJECT]</title>
<style type="text/css">
@media screen and (max-width: 600px) {
table[class="container"] {
width: 95% !important;
}
}
#outlook a {padding:0;}
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
a img {border:none;}
.image_fix {display:block;}
p {margin: 1em 0;}
h1, h2, h3, h4, h5, h6 {color: black !important;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color: blue !important;}
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {
color: red !important;
}
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
color: purple !important;
}
table td {border-collapse: collapse;}
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
a {color: #000;}
@media only screen and (max-device-width: 480px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: black; /* or whatever your want */
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: orange !important; /* or whatever your want */
pointer-events: auto;
cursor: default;
}
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: blue; /* or whatever your want */
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: orange !important;
pointer-events: auto;
cursor: default;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
/* Put your iPhone 4g styles in here */
}
@media only screen and (-webkit-device-pixel-ratio:.75){
/* Put CSS for low density (ldpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1){
/* Put CSS for medium density (mdpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1.5){
/* Put CSS for high density (hdpi) Android layouts in here */
}
/* end Android targeting */
h2{
color:#181818;
font-family:Helvetica, Arial, sans-serif;
font-size:22px;
line-height: 22px;
font-weight: normal;
}
a.link1{
}
a.link2{
color:#fff;
text-decoration:none;
font-family:Helvetica, Arial, sans-serif;
font-size:16px;
color:#fff;border-radius:4px;
}
p{
color:#555;
font-family:Helvetica, Arial, sans-serif;
font-size:16px;
line-height:160%;
}
</style>
<script type="colorScheme" class="swatch active">
{
"name":"Default",
"bgBody":"ffffff",
"link":"fff",
"color":"555555",
"bgItem":"ffffff",
"title":"181818"
}
</script>
</head>
<body>
<?php echo $this->fetch('content') ?>
</body>
</html>
\ No newline at end of file
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<?php echo $this->Html->image('../img/core/img/logo-connect-login@3x.png', ['alt' => 'Logo']); ?> <?php echo $this->Html->image('../img/core/img/logo-connect-login@3x.png', ['alt' => 'Logo']); ?>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'verify'], <?php
echo $this->Form->create(null, ['url' => ['controller' => 'Users', 'action' => 'verify'],
'id' => '', 'name' => 'Users', 'role' => 'form', 'onsubmit' => 'return validateForm()']); 'id' => '', 'name' => 'Users', 'role' => 'form', 'onsubmit' => 'return validateForm()']);
?> ?>
<?php echo $this->Flash->render() ?> <?php echo $this->Flash->render() ?>
...@@ -53,12 +54,11 @@ ...@@ -53,12 +54,11 @@
</label> </label>
</div> </div>
</div> </div>
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
</div> </div>
<!----------------------------------------------------------------------> <script type="text/javascript">
<script>
function validateForm() { function validateForm() {
var x = document.forms["Users"]["data[username]"].value; var x = document.forms["Users"]["data[username]"].value;
if (x == null || x == "") { if (x == null || x == "") {
...@@ -72,7 +72,10 @@ ...@@ -72,7 +72,10 @@
} }
} }
</script> </script>
<style>
<style type="text/css">
#alertBox { #alertBox {
position:relative; position:relative;
width:300px; width:300px;
...@@ -179,7 +182,7 @@ ...@@ -179,7 +182,7 @@
} }
</style> </style>
<script> <script type="text/javascript">
var ALERT_TITLE = ""; var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok"; var ALERT_BUTTON_TEXT = "Ok";
......
<script type='text/javascript'>
setTimeout(function(){
if (typeof Login == 'undefined') {
location = '<?php echo $redirectApplicationURL; ?>';
} else {
Login.onLogin('<?php echo $statusCode; ?>','<?php echo $redirectApplicationURL; ?>','<?php echo $topic; ?>');
}
}, 1000);
</script>;
\ No newline at end of file
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