geforkt von SteamWar/BungeeCore
Merge pull request 'Bye Bye Mail.' (#421) from emaillessWeb into master
Reviewed-on: SteamWar/BungeeCore#421 Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Commit
328d904f69
@ -168,7 +168,7 @@ public class BungeeCore extends Plugin {
|
||||
|
||||
if(!EVENT_MODE){
|
||||
new BauCommand();
|
||||
new WebregisterCommand();
|
||||
new WebpasswordCommand();
|
||||
new FightCommand();
|
||||
new ChallengeCommand();
|
||||
new HistoricCommand();
|
||||
|
@ -19,58 +19,45 @@
|
||||
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.SWException;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class WebregisterCommand extends SWCommand {
|
||||
public class WebpasswordCommand extends SWCommand {
|
||||
|
||||
public WebregisterCommand() {
|
||||
super("webregister", null, "web", "webpw");
|
||||
public WebpasswordCommand() {
|
||||
super("webpassword", null, "webpw", "web");
|
||||
}
|
||||
|
||||
|
||||
@Register(description = "WEB_USAGE")
|
||||
public void genericCommand(ProxiedPlayer player, String email) {
|
||||
ProcessBuilder pb = new ProcessBuilder("php", "/var/www/register.php", player.getName(), email);
|
||||
public void genericCommand(ProxiedPlayer player, String password) {
|
||||
if(password.length() < 8) {
|
||||
ChatSender.of(player).system("WEB_PASSWORD_LENGTH");
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder("php", "/var/www/register.php", player.getName(), password);
|
||||
pb.redirectErrorStream(true);
|
||||
try {
|
||||
Process regProcess = pb.start();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(regProcess.getInputStream()));
|
||||
String errorLine;
|
||||
boolean error = false;
|
||||
while((errorLine = reader.readLine()) != null){
|
||||
switch(errorLine){
|
||||
case "username_exists":
|
||||
Message.send("WEB_ALREADY", player);
|
||||
break;
|
||||
case "email_exists":
|
||||
Message.send("WEB_ALREADY_EMAIL", player);
|
||||
// SWException.log("Bungee", "Duplicate E-Mail", player.getName() + " " + args[0]);
|
||||
break;
|
||||
case "invalid_email":
|
||||
Message.send("WEB_NOT_EMAIL", player);
|
||||
break;
|
||||
case "email_updated":
|
||||
Message.send("WEB_EMAIL_REFRESH", player);
|
||||
break;
|
||||
default:
|
||||
Message.send("WEB_INTERNAL_ERROR", player);
|
||||
SWException.log("Bungee", "Unknown Wordpress User Creation Error", errorLine);
|
||||
if((errorLine = reader.readLine()) != null) {
|
||||
if ("updated".equals(errorLine)) {
|
||||
ChatSender.of(player).system("WEB_UPDATED");
|
||||
return;
|
||||
} else {
|
||||
throw new SecurityException("Could not create webaccount " + errorLine);
|
||||
}
|
||||
error = true;
|
||||
}
|
||||
|
||||
if(error)
|
||||
return;
|
||||
|
||||
Message.send("WEB_EMAIL_SEND", player);
|
||||
ChatSender.of(player).system("WEB_CREATED");
|
||||
} catch (IOException e) {
|
||||
Message.send("WEB_INTERNAL_ERROR", player);
|
||||
throw new SecurityException("Could not create webaccount", e);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ package de.steamwar.bungeecore.sql;
|
||||
import com.google.gson.JsonParser;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.commands.WebregisterCommand;
|
||||
import de.steamwar.bungeecore.commands.WebpasswordCommand;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.bungeecore.network.NetworkSender;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
@ -121,7 +121,7 @@ public class SteamwarUser {
|
||||
String userName = connection.getName();
|
||||
if (!user.userName.equals(userName)) {
|
||||
updateName.update(userName, user.id);
|
||||
WebregisterCommand.changeUsername(user.userName, userName);
|
||||
WebpasswordCommand.changeUsername(user.userName, userName);
|
||||
user.userName = userName;
|
||||
}
|
||||
} else {
|
||||
|
@ -498,13 +498,10 @@ UNIGNORE_NOT_IGNORED=§cYou are not ignoring this player.
|
||||
UNIGNORE_UNIGNORED=§7You ignored §e{0}§8.
|
||||
|
||||
#WebregisterCommand
|
||||
WEB_USAGE=§8/§7webregister §8[§eE-Mail§8]
|
||||
WEB_ALREADY=§cYou already have a webaccount.
|
||||
WEB_ALREADY_EMAIL=§cYou already used this E-Mail address on another account...
|
||||
WEB_NOT_EMAIL=§c[E-Mail], not [free text]!
|
||||
WEB_EMAIL_REFRESH=§aYour E-Mail was updated.
|
||||
WEB_INTERNAL_ERROR=§cAn internal error occurred, please contact a developer.
|
||||
WEB_EMAIL_SEND=§aAn E-Mail to reset your password has been sent.
|
||||
WEB_USAGE=§8/§7webpassword §8[§epassword§8]
|
||||
WEB_UPDATED=§7Your password was updated.
|
||||
WEB_CREATED=§7Your webaccount was created.
|
||||
WEB_PASSWORD_LENGTH=§cYour password is shorter than 8 characters.
|
||||
|
||||
#ChatListener
|
||||
CHAT_LIXFEL_ACTION_BAR=§4§lTechnical problems?
|
||||
|
@ -477,13 +477,10 @@ UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht.
|
||||
UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8.
|
||||
|
||||
#WebregisterCommand
|
||||
WEB_USAGE=§8/§7webregister §8[§eE-Mail§8]
|
||||
WEB_ALREADY=§cDu hast bereits einen Webaccount.
|
||||
WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet...
|
||||
WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]!
|
||||
WEB_EMAIL_REFRESH=§aDeine E-Mail-Adresse wurde aktualisiert.
|
||||
WEB_INTERNAL_ERROR=§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer.
|
||||
WEB_EMAIL_SEND=§aEine E-Mail zum Setzen des Passworts wurde gesendet.
|
||||
WEB_USAGE=§8/§7webpassword §8[§ePasswort§8]
|
||||
WEB_UPDATED=§7Dein Passwort wurde aktualisiert.
|
||||
WEB_CREATED=§7Dein Webaccount wurde erstellt.
|
||||
WEB_PASSWORD_LENGTH=§cDein Passwort ist kürzer als 8 Zeichen.
|
||||
|
||||
#ChatListener
|
||||
CHAT_LIXFEL_ACTION_BAR=§4§lTechnische Probleme?
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren