Merge pull request #4154 from Jatc252/userid-to-username

Make webregister command a bit nicer
This commit is contained in:
mikeprimm 2025-01-05 13:56:17 -06:00 committed by GitHub
commit 89fbc21333
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 11 deletions

View file

@ -182,36 +182,36 @@ public class WebAuthManager {
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);

View file

@ -62,11 +62,11 @@
<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>
@ -80,11 +80,11 @@ Enter user ID and password:
<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>