本文整理汇总了PHP中Security::setHash方法的典型用法代码示例。如果您正苦于以下问题:PHP Security::setHash方法的具体用法?PHP Security::setHash怎么用?PHP Security::setHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Security
的用法示例。
在下文中一共展示了Security::setHash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFilter
public function beforeFilter()
{
$this->Auth->allow('index', 'view', 'logout', 'login');
Security::setHash('md5');
/**
@ Set Value default For Layout Cpanal in Left Menu
@ Alongkot
@ date 16 Nov 14
*/
$this->set('homeMenu', '');
$this->set('comicMenu', '');
$this->set('SentMenu', '');
$this->set('WaitMenu', '');
$this->set('ApprveMenu', '');
$this->set('infoMenu', '');
$this->set('MygroupMenu', '');
$this->set('userMenu', '');
$this->set('companyMenu', '');
$this->set('statMenu', '');
$this->set('referer', $this->referer);
$this->set('Auth', $this->Auth);
$this->set('title_for_layout', '-:: ฐานข้อมูลการจัดการกากอุตสาหกรรม และสิ่งปฏิกูลฯ นิคมอุตสาหกรรมภาคเหนือ ::-');
//Set admin layout for action that have admin
if ($this->Auth->user('role') == 'admin') {
$this->layout = 'cpanel';
} else {
if ($this->Auth->user('role') == 'user') {
$this->layout = 'cpanel_user';
}
}
/////// Custom message Error & Login Fail
$this->Auth->authError = '<i class="fa fa-exclamation-triangle"></i> พื้นที่การในส่วนนี้ได้รับการป้องกันการเข้าถึงข้อมูล กรุณาเข้าสู่ระบบเพื่อใช้งาน...!!!';
}
示例2: beforeFilter
function beforeFilter()
{
//$this->Auth->allow('*');
$this->Auth->authorize = 'controller';
$this->Auth->logoutRedirect = '/';
Security::setHash('md5');
$this->set('Auth', $this->Auth->user());
if ($this->Auth->user('tipo') == 'consultor') {
$this->Session->write('Empresa.id', $this->Auth->user('empresa_id'));
}
if (!$this->Session->check('mes')) {
$this->Session->write('mes', date('m'));
}
if (!$this->Session->check('ano')) {
$this->Session->write('ano', date('Y'));
}
if (!$this->Session->check('fecha')) {
$this->Session->write('fecha', date('Y') . '-' . date('m') . '-00');
}
if ($this->Session->check('Empresa.id')) {
$empr = $this->Empresa->find('first', array('conditions' => array('Empresa.id' => $this->Session->read('Empresa.id')), 'recursive' => 0));
$this->Session->write('Empresa.nombre', $empr['Empresa']['nombre']);
$this->Session->write('Empresa.seguridad_id', $empr['Empresa']['seguridad_id']);
}
}
示例3: beforeFilter
function beforeFilter()
{
//$this->Auth->allow('index','view');
$this->Auth->allow('index', 'view');
//$this->Auth->allow('login','save');
Security::setHash('md5');
}
示例4: beforeFilter
public function beforeFilter()
{
Security::setHash('md5');
if (!isset($this->params['admin']) || !$this->params['admin']) {
$this->Auth->allow();
}
}
示例5: beforeFilter
function beforeFilter()
{
Security::setHash('sha256');
$this->Auth->userModel = 'Account';
$this->Auth->fields = array('username' => 'login', 'password' => 'hashed_password');
$this->Auth->allowedActions = array('register');
$this->Auth->LoginRedirect = array('controller' => 'account', 'action' => 'view');
}
示例6: beforeFilter
function beforeFilter()
{
Security::setHash('sha1');
$this->Auth->userModel = 'Volunteers';
$this->Auth->fields = array('username' => 'email', 'password' => 'password');
// Allow everything...for now
$this->Auth->allow('*');
}
示例7: beforeFilter
/**
* beforeFilter function called before filter
*
* @access public
* @return void
*/
public function beforeFilter()
{
$timezone = $this->SysParameter->findByParameterCode('system.timezone');
// default to UTC if no timezone is set
if (!(empty($timezone) || empty($timezone['SysParameter']['parameter_value']))) {
$timezone = $timezone['SysParameter']['parameter_value'];
// check that the timezone is valid
if (isset($this->validTZ[$timezone])) {
date_default_timezone_set($timezone);
} else {
$this->Session->setFlash(__('An invalid timezone is provided, please edit "system.timezone"', true));
}
}
$this->Auth->autoRedirect = false;
// backward compatible with original ipeer hash method
Security::setHash('md5');
Configure::write('Security.salt', '');
$locale = $this->SysParameter->findByParameterCode('display.locale');
// default to eng if no locale is set
if (!(empty($locale) || empty($locale['SysParameter']['parameter_value']))) {
$locale = $locale['SysParameter']['parameter_value'];
// TODO: check that the locale is valid
Configure::write('Config.language', $locale);
} else {
Configure::write('Config.language', 'eng');
}
// if we have a session transfered to us
if ($this->_hasSessionTransferData()) {
if ($this->_authenticateWithSessionTransferData()) {
if (method_exists($this, '_afterLogin')) {
$this->_afterLogin(false);
}
} else {
$this->Session->setFlash($this->Auth->loginError, $this->Auth->flashElement, array(), 'auth');
}
}
// store user in the singleton for global access
User::store($this->Auth->user());
$this->breadcrumb = Breadcrumb::create();
if ($this->Auth->isAuthorized()) {
// check if the user has permission to access the controller/action
$permission = array_filter(array('controllers', ucwords($this->params['plugin']), ucwords($this->params['controller']), $this->params['action']));
if (!User::hasPermission(join('/', $permission))) {
$this->Session->setFlash('Error: You do not have permission to access the page.');
$this->redirect('/home');
return;
}
$this->_checkSystemVersion();
}
// for setting up google analytics
$trackingId = $this->SysParameter->findByParameterCode('google_analytics.tracking_id');
$domain = $this->SysParameter->findByParameterCode('google_analytics.domain');
$customLogo = $this->SysParameter->findByParameterCode('banner.custom_logo');
$this->set('trackingId', $trackingId);
$this->set('domain', $domain);
$this->set('customLogo', $customLogo);
parent::beforeFilter();
}
示例8: beforeFilter
function beforeFilter()
{
Security::setHash('md5');
//$this->Auth->loginRedirect = array('admin' => 1, 'controller' => 'contacts', 'action' => 'index');
$this->Auth->loginRedirect = array('controller' => 'courses', 'action' => 'index');
// $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login', 'admin' => false);
$this->Auth->loginAction = 'http://myfluentstats.com/Account/Login?ReturnUrl=%2f';
$this->Auth->autoRedirect = false;
$this->Auth->allow('display', 'contactus', 'form', 'checkout', 'reset');
if (isset($this->params['admin']) && $this->params['admin'] == 1) {
$this->layout = "admin";
}
$this->Auth->fields = array('username' => 'email', 'password' => 'password');
//$curuser = $this->Auth->user();
$auth = Configure::read('auth');
if (empty($auth)) {
$curuser = $this->Auth->user();
}
if ($curuser && !empty($curuser)) {
if ($curuser['User']['group_id'] == 2) {
$company = $this->User->Company->find('first', array('conditions' => array('Company.user_id' => $curuser['User']['id'])));
$curuser['Company'] = $company['Company'];
$this->set('custom_logo', $curuser['Company']['logo']);
} elseif ($curuser['User']['group_id'] == 3) {
$this->User->Contact->recursive = 1;
$contact = $this->User->Contact->find('all', array('conditions' => array('Contact.user_id' => $curuser['User']['id'])));
$curuser['Contact'] = $contact['0']['Contact'];
$curuser['Genre'] = $contact['0']['Genre'];
$this->set('custom_logo', $this->User->Company->field("logo", array("Company.id" => $curuser['Contact']['company_id'])));
}
}
$this->set('loggedInUser', $curuser);
$this->curuser = $curuser;
/*
if ($curuser && $val = $this->__checkUserAccess($curuser)) {
//$this->Auth->allow('*');
$this->Auth->allow($this->params['controller']);
$this->Session->setFlash('Allow: ' . $val . ' <pre>' . print_r($this->params, true) . '</pre>');
}
else {
//$this->Auth->deny('*');
$this->Auth->deny($this->params['controller']);
$this->Session->setFlash('Deny: ' . $this->params['controller'] . '<pre>' . print_r($this->params, true) . '
' . print_r($curuser, true) . '</pre>');
}
*/
if ($curuser && !$this->__checkUserAccess($curuser)) {
//$this->Auth->deny('*');
//$this->Auth->deny($this->params['action']);
echo 'hey why are you not working';
$this->Session->setFlash('Weird<pre>' . print_r($curuser, true) . '</pre>');
//exit();
//$this->Session->setFlash('You do not have access to that page.' . $this->params['controller'] . ' : ' . $this->params['action']);
//$this->redirect($this->Auth->logout());
}
$this->siteDown = false;
}
示例9: beforeFilter
public function beforeFilter()
{
if (!$this->ControleDeAcesso->validaAcessoAcao()) {
//$this->Session->setFlash('<strong>Atenção!</strong> Você não tem permissão para acessar esta página.', 'danger');
//$this->redirect(array('controller'=>'principal','action'=>'index'));
}
AuthComponent::$sessionKey = "Auth.Indicadores";
Security::setHash('md5');
}
示例10: beforeFilter
/**
* Overwrite check login and set layout -> Check layout view unlogin and login
*
* @author ThanhN
* @date 2016/05/21
*/
function beforeFilter()
{
Security::setHash("md5");
//echo Security::hash('admin',NULL,TRUE);
$this->Auth->allow(array('login', 'logout'));
$this->settingAuth();
parent::beforeFilter();
$this->set('authUser', $this->Auth->user());
}
示例11: beforeFilter
function beforeFilter()
{
Security::setHash("md5");
$this->authUser = $this->Auth->user();
if (!empty($this->authUser)) {
$this->userId = $this->authUser['User']['id'];
} else {
$this->userId = null;
}
}
示例12: beforeFilter
public function beforeFilter()
{
parent::beforeFilter();
/*
* Hack for Security component to work for AJAX. Normally, CSRF is enabled by
* default and you need to supply a white list. Instead, I pass just the
* action that is being called in the moment, white listing everything
*/
$this->Security->unlockedActions = [$this->request->params['action']];
Security::setHash($this->hashType);
}
示例13: beforeFilter
function beforeFilter()
{
Security::setHash('sha256');
// Configure AuthComponent
$this->Auth->authorize = 'actions';
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
// The action to login
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
// Where we redirect after logout
$this->Auth->loginRedirect = array('controller' => 'patients', 'action' => 'search');
// Where we redirect after login
}
示例14: beforeFilter
function beforeFilter()
{
// Handle the user auth filter
// This, along with no salt in the config file allows for straight
// md5 passwords to be used in the user model
Security::setHash("md5");
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'myprofile');
$this->Auth->logoutRedirect = '/';
$this->Auth->loginError = 'Invalid username / password combination. Please try again';
$this->Auth->authorize = 'controller';
$this->set('usuario', $this->Auth->user());
}
示例15: beforeFilter
function beforeFilter()
{
$this->Auth->authorize = 'Controller';
$user_id = $this->Auth->user('id');
$role = $this->Auth->user('role');
$rol = $this->Auth->user('Rol.id');
Security::setHash('md5');
$this->Auth->allow('*');
$username = $this->Auth->user('username');
if (!empty($user_id)) {
// echo $user_id;
$useraux = $this->User->find('first', array('conditions' => array('User.id' => $user_id)));
$catalogo1 = $useraux['User']['catalogo_id1'];
$catalogo2 = $useraux['User']['catalogo_id2'];
$catalogo3 = $useraux['User']['catalogo_id3'];
$catalogo4 = $useraux['User']['catalogo_id4'];
$modulos = $this->ModulosRol->find('all', array('conditions' => array('ModulosRol.rol_id' => $rol, 'Modulo.modulo_id' => 0, 'Modulo.activo' => 1), 'order' => array('Modulo.orden')));
foreach ($modulos as $m) {
$modulos_id[] = $m['Modulo']['id'];
}
if (!empty($modulos_id)) {
$submodulos = $this->ModulosRol->find('all', array('conditions' => array('ModulosRol.rol_id' => $rol, 'Modulo.modulo_id' => $modulos_id, 'Modulo.activo' => 1)));
foreach ($submodulos as $s) {
$submodulos_id[] = $s['Modulo']['id'];
}
}
}
$contacto = $this->Contenido->find('first', array('conditions' => array('alias' => 'contacto')));
// se tiene que tener un contenido con alias contacto a juro para que desde el home se pueda
// hacer link a contacto desde el botón contáctanos
$config = $this->Config->find('first');
// hacemos el menu
$menu_principal = $this->Modulo->find('all', array('conditions' => array('modulo_id' => 0), 'recursive' => -1, 'order' => array('Modulo.orden')));
foreach ($menu_principal as $m) {
$sub_modulos = $this->Modulo->find('all', array('conditions' => array('modulo_id' => $m['Modulo']['id']), 'recursive' => -1, 'order' => array('Modulo.orden')));
$m['Modulo']['Submodulo'] = $sub_modulos;
$menu[] = $m;
}
$catalogos = $this->Catalogo->find('all', array('order' => array('Catalogo.id')));
foreach ($catalogos as $cc) {
$misc[$cc['Catalogo']['id']] = $cc['Catalogo']['descripcion'];
}
// termina el menu
// numerito de pedidos
$cliente_id = $this->Auth->user('cliente_id');
$pedidos_pendientes = $this->Pedido->find('all', array('conditions' => array('cliente_id' => $cliente_id, 'status !=' => array('Despachado', 'Cancelado'))));
$pedidos_despachado = $this->Pedido->find('all', array('conditions' => array('cliente_id' => $cliente_id, 'status' => array('Despachado'))));
$this->set(compact('username', 'user_id', 'rol', 'modulos', 'submodulos', 'modulos_id', 'submodulos_id', 'contacto', 'config', 'menu', 'pedidos_pendientes', 'pedidos_despachado', 'catalogo1', 'catalogo2', 'catalogo3', 'catalogo4', 'misc'));
}