if ($new_password1 !== $new_password2){ $GLOBALS['error']['password_mismatch'] = 1; $GLOBALS['smarty']->display('page_reset.txt'); exit(); } $rsp = users_update_password($user, $new_password1); if (! $rsp['ok']){ $GLOBALS['error']['update_failed'] = 1; $GLOBALS['smarty']->display('page_reset.txt'); exit(); } users_purge_password_reset_codes($user); users_reload_user($user); login_do_login($user); exit(); } # # output # $smarty->display('page_reset.txt'); exit(); ?>
} # # users deleted? # if ($ok && $user['deleted']) { $smarty->assign('error_deleted', 1); $ok = 0; } # # password match # if ($ok) { $enc_password = login_encrypt_password($password, $GLOBALS['cfg']['crypto_password_secret']); if ($enc_password != $user['password']) { $smarty->assign('error_password', 1); $ok = 0; } } # # it's all good - sign in # if ($ok) { $redir = $redir ? $redir : '/'; login_do_login($user, $redir); exit; } } # # output # $smarty->display('page_signin.txt');
$ok = 0; } if ($ok && $new_pass1 !== $new_pass2) { $smarty->assign('error_newpass_mismatch', 1); $ok = 0; } if ($ok && !strlen($new_pass2)) { $smarty->assign('error_newpass_empty', 1); $ok = 0; } if ($ok) { if (!users_update_password($GLOBALS['cfg']['user'], $new_pass1)) { $smarty->assign('error_fail', 1); $ok = 0; } } if ($ok) { # # Refresh the user so that we pick up the newer password when # we set new cookies. Should this be a function in lib_users? # (20101012/asc) # $GLOBALS['cfg']['user'] = users_get_by_id($GLOBALS['cfg']['user']['id']); login_do_login($GLOBALS['cfg']['user'], "/account/?password=1"); exit; } } # # output # $smarty->display("page_account_password.txt");
$smarty->display('page_reset.txt'); exit; } $smarty->assign('reset_code', $reset_code); if (post_isset('done')) { $new_password1 = post_str('new_password1'); $new_password2 = post_str('new_password2'); if (!$new_password1 || !$new_password2) { $smarty->assign('error_missing_password', 1); $smarty->display('page_reset.txt'); exit; } if ($new_password1 !== $new_password2) { $smarty->assign('error_password_mismatch', 1); $smarty->display('page_reset.txt'); exit; } if (!users_update_password($user, $new_password1)) { $smarty->assign('error_update_failed', 1); $smarty->display('page_reset.txt'); exit; } users_purge_password_reset_codes($user); $user = users_get_by_id($user['id']); login_do_login($user, "/account?password=1"); exit; } # # output # $smarty->display('page_reset.txt');
if ($ok && users_is_email_taken($email)) { $smarty->assign('email', ''); $smarty->assign('error_email_taken', 1); $ok = 0; } # # username available? # if ($ok && users_is_username_taken($username)) { $smarty->assign('username', ''); $smarty->assign('error_username_taken', 1); $ok = 0; } # # create account # if ($ok) { $ret = users_create_user(array('username' => $username, 'email' => $email, 'password' => $password)); if ($ret['ok']) { $redir = strlen($redir) ? $redir : '/'; login_do_login($ret['user'], $redir); exit; } $smarty->assign('error_failed', 1); $ok = 0; } } # # output # $smarty->display('page_signup.txt');
$args = array( 'grant_type' => 'authorization_code', 'code' => $_GET['code'], 'client_id' => $cfg['api_client_id'], 'client_secret' => $cfg['api_client_secret'], 'redirect_uri' => $cfg['api_redir_url'], ); $ret = curl_api_call('/oauth2/token', $args); if (!$ret['ok']) error_misc($ret); $oauth_token = $ret['access_token']; login_do_login($oauth_token); # # good to go - fetch some player info # $ret = curl_api_call('/simple/auth.check', array( 'oauth_token' => $oauth_token, )); db_insert_dupe('glitchmash_players', array( 'tsid' => AddSlashes($ret['player_tsid']), 'date_added' => time(), 'oauth_token' => AddSlashes($oauth_token), 'name' => AddSlashes($ret['player_name']),