Esempio n. 1
0
        $GLOBALS['error']['invalid_code'] = 1;
    }
}
# User is trying to request an invite code?
$crumb_key = 'invite';
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    $code = post_str("code");
    $email = post_str("email");
    # just in case the jquery doesn't work or something...
    $code = $code == "3x4mpl3c0d3" ? null : $code;
    $email = $email == "*****@*****.**" ? null : $email;
    if ($code) {
        if ($invite = invite_codes_get_by_code($code)) {
            invite_codes_signin($invite, $redir);
            exit;
        } else {
            $GLOBALS['error']['invalid_code'] = 1;
        }
    } else {
        if ($email) {
            $email = post_str("email");
            if (!rfc822_is_valid_email_address($email)) {
                $GLOBALS['error']['invalid_email'] = 1;
            } else {
                $rsp = invite_codes_create($email);
                if ($rsp['ok']) {
                    $invite = $rsp['invite'];
                    if ($invite['sent']) {
                        invite_codes_send_invite($invite);
Esempio n. 2
0
        $GLOBALS['error']['invalid_code'] = 1;
    }
}
# User is trying to request an invite code?
$crumb_key = 'invite';
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    $code = post_str("code");
    $email = post_str("email");
    # just in case the jquery doesn't work or something...
    $code = $code == "3x4mpl3c0d3" ? null : $code;
    $email = $email == "*****@*****.**" ? null : $email;
    if ($code) {
        if ($invite = invite_codes_get_by_code($code)) {
            invite_codes_signin($invite);
            exit;
        } else {
            $GLOBALS['error']['invalid_code'] = 1;
        }
    } else {
        if ($email) {
            $email = post_str("email");
            if (!rfc822_is_valid_email_address($email)) {
                $GLOBALS['error']['invalid_email'] = 1;
            } else {
                $rsp = invite_codes_create($email);
                if ($rsp['ok']) {
                    $invite = $rsp['invite'];
                    if ($invite['sent']) {
                        invite_codes_send_invite($invite);