public function up()
 {
     $this->createTable('{{users}}', array('id' => 'pk', 'first_name' => 'string NOT NULL', 'last_name' => 'string', 'email' => 'string NOT NULL', 'password' => 'string NOT NULL', 'image' => 'string', 'bio' => 'string', 'created' => 'DATETIME', 'updated' => 'DATETIME'));
     $this->insert('{{users}}', array('first_name' => 'SnapCMS', 'last_name' => 'Admin', 'email' => '*****@*****.**', 'password' => SnapUtil::doHash('password')));
     $this->insert('{{users}}', array('first_name' => 'SnapCMS', 'last_name' => 'Editor', 'email' => '*****@*****.**', 'password' => SnapUtil::doHash('password')));
 }
示例#2
0
 /**
  * Encrypt password before saving
  */
 public function afterValidate()
 {
     if ($this->scenario == 'changePassword' || $this->scenario == 'register') {
         $this->password = SnapUtil::doHash($this->password);
         $this->password_repeat = SnapUtil::doHash($this->password_repeat);
     }
     return parent::afterValidate();
 }