Skip to content

Commit

Permalink
Merge pull request #4154 from Jatc252/userid-to-username
Browse files Browse the repository at this point in the history
Make webregister command a bit nicer
  • Loading branch information
mikeprimm authored Jan 5, 2025
2 parents 17773c9 + 4f362a5 commit 89fbc21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions DynmapCore/src/main/java/org/dynmap/WebAuthManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,36 +182,36 @@ public boolean processWebRegisterCommand(DynmapCore core, DynmapCommandSender se
boolean other = false;
if(args.length > 1) {
if(!core.checkPlayerPermission(sender, "webregister.other")) {
sender.sendMessage("Not authorized to set web login information for other players");
sender.sendMessage("You're not authorised to access web registration info for other players");
return true;
}
uid = args[1];
other = true;
}
else if (player == null) { /* Console? */
sender.sendMessage("Must provide user ID to register web login");
sender.sendMessage("Must provide username to access web registration info");
return true;
}
else {
uid = player.getName();
}
if (checkUserName(uid) == false) {
sender.sendMessage("Invalid user ID");
sender.sendMessage("Invalid username. Did you type it correctly?");
return true;
}
String regkey = String.format("%04d-%04d", rnd.nextInt(10000), rnd.nextInt(10000));
pending_registrations.put(uid.toLowerCase(), regkey.toLowerCase());
sender.sendMessage("Registration pending for user ID: " + uid);
sender.sendMessage("Registration pending for username: " + uid);
sender.sendMessage("Registration code: " + regkey);
publicRegistrationURL = core.configuration.getString("publicURL", "index.html");
sender.sendMessage("Enter ID and code on registration web page (" + publicRegistrationURL.toString() + ") to complete registration");
sender.sendMessage("Enter username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
if(other) {
DynmapPlayer p = core.getServer().getPlayer(uid);
if(p != null) {
if(p != null && sender != p) {
p.sendMessage("The registration of your account for web access has been started.");
p.sendMessage("To complete the process, access the Login page on the Dynmap map");
p.sendMessage("Registration code: " + regkey);
p.sendMessage("The user ID must match your account ID, but the password should NOT be the same.");
p.sendMessage("Enter your username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
}
}
core.events.trigger("loginupdated", null);
Expand Down
8 changes: 4 additions & 4 deletions DynmapCore/src/main/resources/extracted/web/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ <h2>Minecraft Dynamic Map - Login/Register</h2>
<tr><td class='login'>
<FORM METHOD=POST name=login ACTION="up/login">
<p>
Enter user ID and password:
Enter username and password:
<BR>
<BR>
<table>
<tr><td>User ID</td><td><input type="text" size="20" name="j_username"></td></tr>
<tr><td>Username</td><td><input type="text" size="20" name="j_username"></td></tr>
<tr><td>Password</td><td><input type="password" size="20" name="j_password"></td></tr>
</table>
<BR>
Expand All @@ -80,11 +80,11 @@ <h2>Minecraft Dynamic Map - Login/Register</h2>
<td class='register'>
<FORM METHOD=POST name=register ACTION="up/register">
<p>
Run '/dynmap webregister' and enter returned registration code, along with userid and password:
Run '/dynmap webregister' and enter your username and registration code, and create a password:
<BR>
<BR>
<table>
<tr><td>User ID</td><td><input type="text" size="20" name="j_username"></td></tr>
<tr><td>Username</td><td><input type="text" size="20" name="j_username"></td></tr>
<tr><td>Password</td><td><input type="password" size="20" name="j_password"></td></tr>
<tr><td>Verify Password</td><td><input type="password" size="20" name="j_verify_password"></td></tr>
<tr><td>Registration Code</td><td><input type="text" size="20" name="j_passcode"></td></tr>
Expand Down

0 comments on commit 89fbc21

Please sign in to comment.