GBUser::passhash PHP Method

passhash() static public method

static public passhash ( $email, $passphrase, $context = 'gb-admin' )
    static function passhash($email, $passphrase, $context = 'gb-admin')
    {
        return CHAP::shadow($email, $passphrase, $context);
    }

Usage Example

示例#1
0
文件: setup.php 项目: rsms/gitblog
    # -------------------------------------------------------------------------
    # commit changes (done by gb::init())
    if (!gb::$errors) {
        try {
            if (!git::commit('gitblog created', trim($_POST['name']) . ' <' . trim($_POST['email']) . '>')) {
                gb::$errors[] = 'failed to commit creation';
            }
        } catch (Exception $e) {
            gb::$errors[] = 'failed to commit creation: ' . nl2br(h(strval($e)));
        }
    }
    # -------------------------------------------------------------------------
    # create admin account
    if (!gb::$errors) {
        $_POST['email'] = trim($_POST['email']);
        $passhash = GBUser::passhash($_POST['email'], $_POST['passphrase']);
        $u = new GBUser(trim($_POST['name']), $_POST['email'], $passhash, true);
        $u->save();
        # issues git add, that's why we do this after init
    }
    # -------------------------------------------------------------------------
    # send the client along
    if (!gb::$errors) {
        header('Location: ' . gb::$site_url);
        exit(0);
    }
}
# ------------------------------------------------------------------------------------------------
# Perform a few sanity checks
#else {
#