Mark fields as final in VerificationData and ContactFormData
The 'code', 'eMail' fields in the VerificationData class and 'username', 'email', 'question' fields in the ContactFormData class are now marked as 'final'. At the same time, some unused imports from ContactController, ContactFormData, FormQuery, and VerifyController have been removed for code cleanliness.
This commit is contained in:
parent
917965a33d
commit
4ec41d8a7e
|
|
@ -1,5 +1,4 @@
|
||||||
package com.alttd.forms.contact;
|
package com.alttd.forms.contact;
|
||||||
import com.alttd.forms.mail.mail_forms.MailForm;
|
|
||||||
import com.alttd.forms.mail.verification.VerificationResult;
|
import com.alttd.forms.mail.verification.VerificationResult;
|
||||||
import com.alttd.forms.mail.verification.Verify;
|
import com.alttd.forms.mail.verification.Verify;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package com.alttd.forms.contact;
|
package com.alttd.forms.contact;
|
||||||
|
|
||||||
import com.alttd.forms.form.Form;
|
import com.alttd.forms.form.Form;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
|
@ -19,15 +17,15 @@ public class ContactFormData extends Form {
|
||||||
@NotEmpty(message = "You have to provide a username")
|
@NotEmpty(message = "You have to provide a username")
|
||||||
@Length(min = 3, max = 16, message = "Usernames have to be between 3 and 16 characters")
|
@Length(min = 3, max = 16, message = "Usernames have to be between 3 and 16 characters")
|
||||||
@Pattern(regexp = "[a-zA-Z-0-9_]{3,16}", message = "Your username has to be a valid Minecraft username")
|
@Pattern(regexp = "[a-zA-Z-0-9_]{3,16}", message = "Your username has to be a valid Minecraft username")
|
||||||
public String username;
|
public final String username;
|
||||||
|
|
||||||
@NotEmpty(message = "You have to provide an e-mail address")
|
@NotEmpty(message = "You have to provide an e-mail address")
|
||||||
@Email(regexp = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])",
|
@Email(regexp = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])",
|
||||||
message = "This is not a valid e-mail address")
|
message = "This is not a valid e-mail address")
|
||||||
public String email;
|
public final String email;
|
||||||
|
|
||||||
@Length(min = 11, max = 2000, message = "Your question should have between 10 and 2000 characters")
|
@Length(min = 11, max = 2000, message = "Your question should have between 10 and 2000 characters")
|
||||||
public String question;
|
public final String question;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.alttd.forms.verify_mail;
|
package com.alttd.forms.verify_mail;
|
||||||
|
|
||||||
import com.alttd.forms.contact.ContactFormData;
|
import com.alttd.forms.contact.ContactFormData;
|
||||||
import com.alttd.forms.contact.StoreFormQuery;
|
|
||||||
import com.alttd.forms.database.DatabaseConnection;
|
import com.alttd.forms.database.DatabaseConnection;
|
||||||
import com.alttd.forms.form.Form;
|
import com.alttd.forms.form.Form;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ public class VerificationData {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "You must provide a valid code")
|
@NotBlank(message = "You must provide a valid code")
|
||||||
String code;
|
final String code;
|
||||||
|
|
||||||
@NotBlank(message = "You must provide an email")
|
@NotBlank(message = "You must provide an email")
|
||||||
@Email(regexp = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])",
|
@Email(regexp = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])",
|
||||||
message = "This is not a valid e-mail address")
|
message = "This is not a valid e-mail address")
|
||||||
String eMail;
|
final String eMail;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.alttd.forms.verify_mail;
|
package com.alttd.forms.verify_mail;
|
||||||
|
|
||||||
import com.alttd.forms.form.Form;
|
|
||||||
import com.alttd.forms.mail.mail_forms.MailForm;
|
import com.alttd.forms.mail.mail_forms.MailForm;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user