cakephp-2.0

Changing password with CakePHP and blowfish

倾然丶 夕夏残阳落幕 提交于 2019-12-04 11:18:46
I'm trying to set up a form to allow a user to change their password using CakePHP 2.3. The algorithm being used is blowfish. I have the following three fields: <?php echo $this->Form->input('old_password', array('type' => 'password', 'autocomplete' => 'off')); ?> <?php echo $this->Form->input('new_password', array('type' => 'password', 'autocomplete' => 'off')); ?> <?php echo $this->Form->input('new_password_confirm', array('type' => 'password', 'autocomplete' => 'off', 'label' => 'Confirm Password')); ?> Here is the code where I'm trying to verify they entered their old password correctly:

CakePHP 2.0 Determine which submit button has been clicked

我的未来我决定 提交于 2019-12-04 10:39:48
问题 In CakePHP 1.3 you can create a form with multiple submit buttons: echo $this->Form->submit('Submit 1', array('name'=>'submit'); echo $this->Form->submit('Submit 2', array('name'=>'submit'); and detect which submit button was pressed in the controller with: if (isset($this->params['form']['submit']) && $this->params['form']['submit'] == "Submit 1") { // first button clicked } In CakePHP, $this->params['form'] isn't set and the clicked button value doesn't appear anywhere in $this->request,

Render View from AppExceptionHandler

一曲冷凌霜 提交于 2019-12-04 09:09:19
I'm working with CakePHP 2.0 and want to handle a ForbiddenException. I've followed the example explained at the CakePHP Cookbook. My exception is now caught at the AppExceptionHandler but I don't know how to move from here. I want to render a relevant View but $this is not available. Does anyone have a starting point for me? Edit: My code so far is identical to the Cookbook example: In app/Config/core.php Configure::write('Exception.handler', 'AppExceptionHandler::handle'); In app/Config/bootstrap.php App::uses('AppExceptionHandler', 'Lib'); In app/Lib/AppExecptionHandler.php class

cakephp plugin model/controller cache issue with main model/controller

末鹿安然 提交于 2019-12-04 06:54:17
问题 I have a plugin with user model, profile model and an user controller, in this user model is associated with profile model. In my main model folder (under app), I have user model and user controller(here I have not associated with profile). Sometimes I'm getting errors saying that user model is not associated with profile model. Also sometimes I'm getting the error - "missing action logout in users controller". I have given the logout action in the app/controller/userscontroller but that

CakePHP: FormHelper not saving data from two inputs with same name

隐身守侯 提交于 2019-12-04 05:00:13
问题 Inside my form there is a long row of checkboxes which I want to show as two columns of checkboxes (for reasons related to presentation). So in the following code I split the options into two separate arrays and create two different options by the same name. When I debug($this->request->data); the 'location' key is always empty. However, the same code works as a single input just fine. What am I doing wrong? <?php $count = count($location_options); //$location_options is passed from the

Cakephp can't change database on-the-fly

。_饼干妹妹 提交于 2019-12-04 04:29:35
问题 I am trying to connect from multiples databases from a loop, but seens CakePHP can't change database , only others infos (like user/pass/host). app/Config/database.php <?php class DATABASE_CONFIG { [...] public $default = array( [..] // Where I have the companies ); public $client = array( [...] // Fakke settings, because I will change it on-the-fly ); } app/Controller/CronController.php $companies = $this->Company->find('all'); foreach($companies as $company) { $settings = array( 'datasource

Using email instead of username in CakePHP Auth Component

混江龙づ霸主 提交于 2019-12-04 03:54:39
问题 I am working on cakephp 2.x . my problem is i dont want to use username for logging .. i am taking the email and password from the user and verify this email and password from the database i have a table in my database name user and it has 3 fields id , email and password here is my code Model <?php class User extends AppModel { public $useTable = 'user'; } ?> AppController class AppController extends Controller { public $components = array( 'Session', 'Auth'=>array( 'loginRedirect'=>array(

Unexpected error communicating with Stripe

落爺英雄遲暮 提交于 2019-12-04 03:36:19
Billing with Stripe i have a form and i submit information and place the order following error has occured.... Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com. (Network error [errno 77]: error setting certificate verify locations: CAfile: C:\xampp\htdocs\PhpProject2\app\Lib\Stripe/../data/ca-certificates.crt CApath: none ) my controller action code if(!empty($this->request->data)){ $email = $this->request->data['email']; $credit_card = $this->request->data['card_number']; $expire_month = $this->request->data['expiration_month']; $expire

cakephp auth->loginRedirect for admin

此生再无相见时 提交于 2019-12-04 02:45:05
问题 I'm fairly new to cakePHP and have read all the tutorials on the cake site. I'm building a small sample app using cake 2.1 and have hit a problem. Basically, I want admin users redirected to a different page on login than what a normal user gets redirected to. I'm sure there's an easy way to do this but I'm struggling! I have Admin routing enabled and am using the auth component (and the ACL component though that's not affecting my issue). I have 2 logins one for admin - admin_login() and a

Getting associated models with $this->Auth in Cakephp

独自空忆成欢 提交于 2019-12-04 02:32:07
I am using CakePHP 2.0's integrated Auth component. I have the following tables : Users Groups Profiles My model relations are as follows: User belongsTo Group User hasMany Profiles While logged in to the site, I noticed the Auth session contains only User table information, but I need the information of Groups and Profiles tables too for the logged in user. Is there any way to do that with the Auth component? There is no way to do this with the AuthComponent because of the way it handles the session keys. You can, however, just save it to the session yourself. The only way to do this is to