Created
April 2, 2015 12:42
-
-
Save converge/869f52a3bbe748d7fbd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function resetPasswords() { | |
$users = $this->User->find('all', array( | |
'conditions' => array('username REGEXP' => '[0-9]+') | |
) | |
); | |
foreach ($users as $user => $item) { | |
$this->User->read(null, $item['User']['id']); | |
$newPasswd = $this->Auth->password(substr($item['User']['username'], 0, 4)); | |
$this->User->set(array('User.password' => $newPasswd)); | |
$this->User->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment