function execute() { $user = ConnectionHelper::userLogin(); $response = array('result' => '[`Title profile change password success`]'); if (!$user || !Request::post('old_password') || !Request::post('new_password') || !Request::post('repeat_password')) { return array('result' => '[`Title profile change password error`]'); } if (md5(Request::post('old_password')) != $user['password'] || Request::post('new_password') != Request::post('repeat_password')) { return array('result' => '[`Title profile change password error`]'); } $model = new connectionUserModel(); $password = Request::post('new_password'); if (!Validator::Field($password, $model->regFields['password'])) { return array('result' => '[`Title profile change password error`]'); } $model->changePassword($user['id'], $password); return $response; }