Increased maximum Password length from 32 to 1024

This commit is contained in:
CrushedPixel
2015-08-30 21:03:22 +02:00
parent 6712e8c488
commit ca6cfa6b86
4 changed files with 15 additions and 5 deletions

View File

@@ -2,6 +2,10 @@ package eu.crushedpixel.replaymod.gui;
public class GuiConstants {
//didn't find a better place to put these constants
public static final int MIN_PW_LENGTH = 5;
public static final int MAX_PW_LENGTH = 1024;
public static final int CENTER_DOWNLOADED_REPLAYS_BUTTON = 2001;
public static final int CENTER_SEARCH_BUTTON = 2002;
public static final int CENTER_BACK_BUTTON = 2003;

View File

@@ -6,6 +6,7 @@ import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.element.GuiPasswordField;
import de.johni0702.minecraft.gui.element.GuiTextField;
import de.johni0702.minecraft.gui.layout.CustomLayout;
import eu.crushedpixel.replaymod.gui.GuiConstants;
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
public class GuiLoginPrompt extends AbstractGuiScreen<GuiLoginPrompt> {
@@ -20,7 +21,8 @@ public class GuiLoginPrompt extends AbstractGuiScreen<GuiLoginPrompt> {
private GuiButton cancelButton = new GuiButton(this).setI18nLabel("replaymod.gui.cancel").setSize(150, 20);
private GuiButton registerButton = new GuiButton(this).setI18nLabel("replaymod.gui.register").setSize(150, 20);
private GuiTextField username = new GuiTextField(this).setSize(145, 20).setMaxLength(16).setFocused(true);
private GuiPasswordField password = new GuiPasswordField(this).setSize(145, 20).setNext(username).setPrevious(username);
private GuiPasswordField password = new GuiPasswordField(this).setSize(145, 20).setNext(username).setPrevious(username)
.setMaxLength(GuiConstants.MAX_PW_LENGTH);
{
Runnable doLogin = new Runnable() {

View File

@@ -8,6 +8,7 @@ import de.johni0702.minecraft.gui.layout.CustomLayout;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.layout.VerticalLayout;
import eu.crushedpixel.replaymod.api.ApiException;
import eu.crushedpixel.replaymod.gui.GuiConstants;
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
import eu.crushedpixel.replaymod.utils.EmailAddressUtils;
import eu.crushedpixel.replaymod.utils.RegexUtils;
@@ -36,10 +37,10 @@ public class GuiRegister extends AbstractGuiScreen<GuiRegister> {
.addElements(data, mailInput = new GuiTextField().setSize(145, 20)),
new GuiPanel().setLayout(new HorizontalLayout(HorizontalLayout.Alignment.RIGHT).setSpacing(10))
.addElements(data, new GuiLabel().setI18nText("replaymod.gui.password"))
.addElements(data, passwordInput = new GuiPasswordField().setMaxLength(32).setSize(145, 20)),
.addElements(data, passwordInput = new GuiPasswordField().setMaxLength(GuiConstants.MAX_PW_LENGTH+1).setSize(145, 20)),
new GuiPanel().setLayout(new HorizontalLayout(HorizontalLayout.Alignment.RIGHT).setSpacing(10))
.addElements(data, new GuiLabel().setI18nText("replaymod.gui.register.confirmpw"))
.addElements(data, passwordConfirmation = new GuiPasswordField().setMaxLength(32).setSize(145, 20))
.addElements(data, passwordConfirmation = new GuiPasswordField().setMaxLength(GuiConstants.MAX_PW_LENGTH+1).setSize(145, 20))
);
usernameInput.setNext(mailInput)
.getNext().setNext(passwordInput)
@@ -113,8 +114,10 @@ public class GuiRegister extends AbstractGuiScreen<GuiRegister> {
status = "replaymod.gui.register.error.shortusername";
} else if(!RegexUtils.isValid(RegexUtils.ALPHANUMERIC_UNDERSCORE, usernameInput.getText().trim())) {
status = "replaymod.gui.register.error.invalidname";
} else if (passwordInput.getText().length() < 5) {
} else if (passwordInput.getText().length() < GuiConstants.MIN_PW_LENGTH) {
status = "replaymod.gui.register.error.shortpw";
} else if (passwordInput.getText().length() > GuiConstants.MAX_PW_LENGTH) {
status = "replaymod.gui.register.error.longpw";
} else if (!EmailAddressUtils.isValidEmailAddress(mailInput.getText())) {
status = "replaymod.api.invalidmail";
} else if (!passwordConfirmation.getText().equals(passwordInput.getText())) {

View File

@@ -28,7 +28,7 @@ replaymod.api.mcuserexists=A ReplayMod account is already associated with this M
replaymod.api.filetoobig=The uploaded file is too big
replaymod.api.usernametoolong=The username is too long
replaymod.api.descriptiontoolong=The description is too long
replaymod.api.passwordlength=The password has to be between 5 and 32 characters long
replaymod.api.passwordlength=The password has to be between 5 and 1024 characters long
replaymod.api.suspended=Your account has been suspended
#All of the chat messages
@@ -136,6 +136,7 @@ replaymod.gui.register.error.nomatch=Passwords don't match
replaymod.gui.register.error.shortusername=Username has to be at least 5 characters long
replaymod.gui.register.error.invalidname=Username may only contain letters and numbers
replaymod.gui.register.error.shortpw=Password has to be at least 5 characters long
replaymod.gui.register.error.longpw=Password has to be at most 1024 characters long
replaymod.gui.register.error.authfailed=Could not authenticate your Minecraft account
#Replay Viewer GUI