Settle down, Matt

This commit is contained in:
Tekaoh
2020-05-08 11:53:43 -04:00
parent d5e49ba7b0
commit 3ead342302
6 changed files with 18 additions and 17 deletions

View File

@@ -1,11 +1,11 @@
# SWG Authentication for Wordpress
# SWG Authentication for WordPress
# Usage:
1. Upload the plugin files to the `wp-content/plugins/swg-auth/` directory or install the plugin through the WordPress Admin Panel.
2. Activate the plugin through the Wordpress Admin Panel.
3. Get the SWG Server config you need from SWG Auth -> Server Config
2. Activate the plugin through the WordPress Admin Panel.
3. Get the SWG Server Config you need from SWG Auth -> Server Config
4. Done!
# Notes:
- Existing users should make a Wordpress account with the _same username_ that they were already using in order to gain access to their existing characters
- Existing users should make a WordPress account with the _same username_ that they were already using in order to gain access to their existing characters
- HTTPS is recommended to avoid sending packets that contain plain text passwords

View File

@@ -8,7 +8,7 @@ if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'swg-auth-admin-level'
// Look up the user's Admin level
$level = get_user_meta( $user->ID, 'swg-auth-admin-level', true );
// If the user is a Wordpress Admin, send back level 50
// If the user is a WordPress Admin, send back level 50
if ( user_can( $user, 'administrator' ) ) {
$response[ 'message' ] = "50";
@@ -23,6 +23,6 @@ if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'swg-auth-admin-level'
// JSON Encode our response so that the server can understand it
echo json_encode( $response );
// Once we've responded, we don't want Wordpress to continue
// Once we've responded, we don't want WordPress to continue
die;
}

View File

@@ -3,14 +3,14 @@
// Check if the swg-auth action is requested and that a user_name and user_password are provided
if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'swg-auth' && isset( $_POST[ 'user_name' ] ) && isset( $_POST[ 'user_password' ] ) ) {
// Ask Wordpress to authenticate the user_name and user_password
// Ask WordPress to authenticate the user_name and user_password
$user = wp_authenticate_username_password( null, $_POST[ 'user_name' ], $_POST[ 'user_password' ] );
// Check if the authentication request returned an error
if ( is_wp_error( $user ) ) {
$response[ 'message' ] = "Account does not exist or password was incorrect";
// Wordpress Administrators are always let in
// WordPress Administrators are always let in
} elseif ( user_can( $user, 'administrator' ) ) {
$response[ 'message' ] = "success";
@@ -29,6 +29,6 @@ if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'swg-auth' && isset( $_
// JSON Encode our response so that the LoginServer knows what we're talking about
echo json_encode( $response );
// Once we've responded, we don't want Wordpress to continue
// Once we've responded, we don't want WordPress to continue
die;
}

View File

@@ -262,5 +262,6 @@ elseif ( isset( $_GET[ 'display' ] ) && $_GET[ 'display' ] === 'class' && isset(
<?php endif; ?>
<?php
// Thanks Oracle! ttyl
oci_close( $connection );

View File

@@ -2,7 +2,7 @@
/**
* Plugin Name: SWG Auth
* Plugin URI: https://tekaohswg.github.io/swg-auth-wordpress.html
* Description: Star Wars Galaxies Authentication for Wordpress
* Description: Star Wars Galaxies Authentication for WordPress
* Version: 0.9
* Author: Tekaoh
* Author URI: https://tekaohswg.github.io
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
// Include some includes
include( plugin_dir_path( __FILE__ ) . 'includes/swg-auth-oci.php' );
// Run when Wordpress is loaded
// Run when WordPress is loaded
add_action( 'wp_loaded', 'swg_auth_run' );
function swg_auth_run() {
include( plugin_dir_path( __FILE__ ) . 'includes/swg-auth-check.php' );

View File

@@ -8,17 +8,17 @@ Requires PHP: 4.3
License: The Unlicense
License URI: https://unlicense.org
Star Wars Galaxies Authentication for Wordpress
Star Wars Galaxies Authentication for WordPress
== Description ==
If you're running a Star Wars Galaxies server, now you can use Wordpress to manage your users.
If you're running a Star Wars Galaxies server, now you can use WordPress to manage your users.
== Installation ==
1. Upload the plugin files to the `wp-content/plugins/swg-auth/` directory or install the plugin through the WordPress Admin Panel.
2. Activate the plugin through the Wordpress Admin Panel.
3. Get the SWG Server config you need from SWG Auth -> Server Config
2. Activate the plugin through the WordPress Admin Panel.
3. Get the SWG Server Config you need from SWG Auth -> Server Config
4. Done!
== Changelog ==
@@ -43,14 +43,14 @@ If you're running a Star Wars Galaxies server, now you can use Wordpress to mana
= 0.4 =
* Optionally, you can require that new accounts have to be specifically approved for game access
* You can now ban an account from the game from the Wordpress Admin Panel
* You can now ban an account from the game from the WordPress Admin Panel
= 0.3 =
* Added an admin menu that provides you with the server config you need
* Bug fixes
= 0.2 =
* Wordpress can now take requests for admin level checks
* WordPress can now take requests for admin level checks
= 0.1 =
* Authentication is functional