Skip to content

Instantly share code, notes, and snippets.

@ackintosh
Last active August 29, 2015 14:08
Show Gist options
  • Save ackintosh/7e9dda34ce9eaf7f3de9 to your computer and use it in GitHub Desktop.
Save ackintosh/7e9dda34ce9eaf7f3de9 to your computer and use it in GitHub Desktop.
Authコンポーネントのパスワードのハッシュ値をコマンドで生成する ref: http://qiita.com/NAKANO_Akihito/items/df54814dded552767cc5
$ ./app/Console/cake gen_password foo
Welcome to CakePHP v2.4.10 Console
---------------------------------------------------------------
App : app
Path: /Users/hoge/cake/app/
---------------------------------------------------------------
c61bf4fc7e757757ce027b9f91801618abaa2f6b
<?php
App::uses('SimplePasswordHasher', 'Controller/Component/Auth');
class GenPasswordShell extends AppShell {
public function main() {
$passwordHasher = new SimplePasswordHasher();
$this->out($passwordHasher->hash($this->args[0]));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment