当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_User::checkPassword方法代码示例

本文整理汇总了PHP中OC_User::checkPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_User::checkPassword方法的具体用法?PHP OC_User::checkPassword怎么用?PHP OC_User::checkPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_User的用法示例。


在下文中一共展示了OC_User::checkPassword方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: changePersonalPassword

 public static function changePersonalPassword($args)
 {
     // Check if we are an user
     \OC_JSON::callCheck();
     \OC_JSON::checkLoggedIn();
     $username = \OC_User::getUser();
     $password = isset($_POST['personal-password']) ? $_POST['personal-password'] : null;
     $oldPassword = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : '';
     if (!\OC_User::checkPassword($username, $oldPassword)) {
         $l = new \OC_L10n('settings');
         \OC_JSON::error(array("data" => array("message" => $l->t("Wrong password"))));
         exit;
     }
     if ($oldPassword === $password) {
         $l = new \OC_L10n('settings');
         \OC_JSON::error(array("data" => array("message" => $l->t("The new password can not be the same as the previous one"))));
         exit;
     }
     if (!is_null($password) && \OC_User::setPassword($username, $password)) {
         \OC::$server->getUserSession()->updateSessionTokenPassword($password);
         \OC_JSON::success();
     } else {
         \OC_JSON::error();
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:25,代码来源:Controller.php

示例2: testAddUser

 public function testAddUser()
 {
     $this->resetParams();
     $_POST['userid'] = $this->getUniqueID();
     $_POST['password'] = 'password';
     $result = \OCA\provisioning_API\Users::addUser(array());
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $this->assertTrue(\OC_User::userExists($_POST['userid']));
     $this->assertEquals($_POST['userid'], \OC_User::checkPassword($_POST['userid'], $_POST['password']));
     $this->users[] = $_POST['userid'];
 }
开发者ID:samj1912,项目名称:repo,代码行数:12,代码来源:userstest.php

示例3: testCheckPassword

 public function testCheckPassword()
 {
     $this->backend->expects($this->once())->method('checkPassword')->with($this->equalTo('foo'), $this->equalTo('bar'))->will($this->returnValue('foo'));
     $this->backend->expects($this->any())->method('implementsActions')->will($this->returnCallback(function ($actions) {
         if ($actions === \OC_USER_BACKEND_CHECK_PASSWORD) {
             return true;
         } else {
             return false;
         }
     }));
     $uid = \OC_User::checkPassword('foo', 'bar');
     $this->assertEquals($uid, 'foo');
 }
开发者ID:0x17de,项目名称:core,代码行数:13,代码来源:user.php

示例4: check

 public static function check()
 {
     $login = isset($_POST['login']) ? $_POST['login'] : false;
     $password = isset($_POST['password']) ? $_POST['password'] : false;
     if ($login && $password) {
         if (\OC_User::checkPassword($login, $password)) {
             $xml['person']['personid'] = $login;
             return new Result($xml);
         } else {
             return new Result(null, 102);
         }
     } else {
         return new Result(null, 101);
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:Person.php

示例5: changePersonalPassword

 public static function changePersonalPassword($args)
 {
     // Check if we are an user
     \OC_JSON::callCheck();
     \OC_JSON::checkLoggedIn();
     $username = \OC_User::getUser();
     $password = isset($_POST['personal-password']) ? $_POST['personal-password'] : null;
     $oldPassword = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : '';
     if (!\OC_User::checkPassword($username, $oldPassword)) {
         $l = new \OC_L10n('settings');
         \OC_JSON::error(array("data" => array("message" => $l->t("Wrong password"))));
         exit;
     }
     if (!is_null($password) && \OC_User::setPassword($username, $password)) {
         \OC_JSON::success();
     } else {
         \OC_JSON::error();
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:19,代码来源:Controller.php

示例6: checkPassword

 /**
  * Check if the password is correct
  * @param string $uid The username
  * @param string $password The password
  * @return string|false username on success, false otherwise
  *
  * Check if the password is correct without logging in the user
  */
 public static function checkPassword($uid, $password)
 {
     return \OC_User::checkPassword($uid, $password);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:12,代码来源:user.php

示例7: isset

OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
// Manually load apps to ensure hooks work correctly (workaround for issue 1503)
OC_APP::loadApps();
$username = isset($_POST['username']) ? $_POST['username'] : OC_User::getUser();
$password = isset($_POST['password']) ? $_POST['password'] : null;
$oldPassword = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : '';
$recoveryPassword = isset($_POST['recoveryPassword']) ? $_POST['recoveryPassword'] : null;
$userstatus = null;
if (OC_User::isAdminUser(OC_User::getUser())) {
    $userstatus = 'admin';
}
if (OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
    $userstatus = 'subadmin';
}
if (OC_User::getUser() === $username && OC_User::checkPassword($username, $oldPassword)) {
    $userstatus = 'user';
}
if (is_null($userstatus)) {
    OC_JSON::error(array('data' => array('message' => 'Authentication error')));
    exit;
}
if (\OCP\App::isEnabled('files_encryption') && $userstatus !== 'user') {
    //handle the recovery case
    $util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), $username);
    $recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
    $validRecoveryPassword = false;
    $recoveryPasswordSupported = false;
    if ($recoveryAdminEnabled) {
        $validRecoveryPassword = $util->checkRecoveryPassword($recoveryPassword);
        $recoveryEnabledForUser = $util->recoveryEnabledForUser();
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:changepassword.php

示例8: header

*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
$RUNTIME_NOAPPS = TRUE;
//no apps, yet
require_once '../../lib/base.php';
if (!OC_User::isLoggedIn()) {
    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="ownCloud Server"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Valid credentials must be supplied';
        exit;
    } else {
        if (!OC_User::checkPassword($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
            exit;
        }
    }
}
$groups = array();
foreach (OC_Group::getGroups() as $i) {
    // Do some more work here soon
    $groups[] = array("groupname" => $i);
}
OC_JSON::encodedPrint($groups);
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:grouplist.php

示例9: isset

<?php

// Init owncloud
require_once '../../lib/base.php';
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$password = $_POST["password"];
$oldPassword = isset($_POST["oldpassword"]) ? $_POST["oldpassword"] : '';
// Check if we are a user
OC_JSON::checkLoggedIn();
if (!OC_Group::inGroup(OC_User::getUser(), 'admin') && ($username != OC_User::getUser() || !OC_User::checkPassword($username, $oldPassword))) {
    OC_JSON::error(array("data" => array("message" => "Authentication error")));
    exit;
}
// Return Success story
if (OC_User::setPassword($username, $password)) {
    OC_JSON::success(array("data" => array("username" => $username)));
} else {
    OC_JSON::error(array("data" => array("message" => "Unable to change password")));
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:19,代码来源:changepassword.php

示例10: authorize_mode

/**
 * Perform a user authorization
 * @global array $profile
 */
function authorize_mode()
{
    global $profile;
    global $USERNAME;
    global $IDENTITY;
    // this is a user session
    // the user needs refresh urls in their session to access this mode
    if (!isset($_SESSION['post_auth_url']) || !isset($_SESSION['cancel_auth_url'])) {
        error_500('You may not access this mode directly.');
    }
    $profile['idp_url'] = $IDENTITY;
    if (isset($_SERVER['PHP_AUTH_USER']) && $profile['authorized'] === false && $_SERVER['PHP_AUTH_USER'] == $USERNAME) {
        if (OC_User::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {
            // successful login!
            // return to the refresh url if they get in
            $_SESSION['openid_auth'] = true;
            $_SESSION['openid_user'] = $USERNAME;
            wrap_redirect($_SESSION['post_auth_url']);
            // failed login
        } else {
            $_SESSION['failures']++;
            debug('Login failed');
            debug('Fail count: ' . $_SESSION['failures']);
        }
    }
    // if we get this far the user is not authorized, so send the headers
    $uid = uniqid(mt_rand(1, 9));
    $_SESSION['uniqid'] = $uid;
    // 	debug('Prompting user to log in. Stale? ' . $stale);
    header('HTTP/1.0 401 Unauthorized');
    // 	header(sprintf('WWW-Authenticate: Digest qop="auth-int, auth", realm="%s", domain="%s", nonce="%s", opaque="%s", stale="%s", algorithm="MD5"', $profile['auth_realm'], $profile['auth_domain'], $uid, md5($profile['auth_realm']), $stale ? 'true' : 'false'));
    header('WWW-Authenticate: Basic realm="ownCloud"');
    $q = strpos($_SESSION['cancel_auth_url'], '?') ? '&' : '?';
    wrap_refresh($_SESSION['cancel_auth_url'] . $q . 'openid.mode=cancel');
    // 	die('401 Unauthorized');
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:40,代码来源:owncloud_apps_user_openid_phpmyid.php

示例11: isset

* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*
*/
$_POST = $_GET;
//debug
require_once '../../lib/base.php';
OC_JSON::checkAppEnabled('media');
require_once 'lib_collection.php';
$user = isset($_POST['user']) ? $_POST['user'] : '';
$pass = isset($_POST['pass']) ? $_POST['pass'] : '';
if (OC_User::checkPassword($user, $pass)) {
    OC_Util::setupFS($user);
    OC_MEDIA_COLLECTION::$uid = $user;
} else {
    exit;
}
if (isset($_POST['play']) and $_POST['play'] == 'true') {
    if (!isset($_POST['song'])) {
        exit;
    }
    $song = OC_MEDIA_COLLECTION::getSong($_POST['song']);
    $ftype = OC_Filesystem::getMimeType($song['song_path']);
    header('Content-Type:' . $ftype);
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_media_tomahawk.php

示例12: isset

// Check if we are a user
OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$password = $_POST["password"];
$oldPassword = isset($_POST["oldpassword"]) ? $_POST["oldpassword"] : '';
$userstatus = null;
if (OC_Group::inGroup(OC_User::getUser(), 'admin')) {
    $userstatus = 'admin';
}
if (OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
    $userstatus = 'subadmin';
}
if (OC_User::getUser() === $username) {
    if (OC_User::checkPassword($username, $oldPassword)) {
        $userstatus = 'user';
    } else {
        if (!OC_Util::isUserVerified()) {
            $userstatus = null;
        }
    }
}
if (is_null($userstatus)) {
    OC_JSON::error(array("data" => array("message" => "Authentication error")));
    exit;
}
if ($userstatus === 'admin' || $userstatus === 'subadmin') {
    OC_JSON::verifyUser();
}
// Return Success story
开发者ID:ryanshoover,项目名称:core,代码行数:30,代码来源:changepassword.php


注:本文中的OC_User::checkPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。