mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-13 13:50:28 +05:30
Add length check for username.
This commit is contained in:
parent
c558572953
commit
f5e881e0e4
@ -633,6 +633,12 @@ public class ResponseHelper {
|
|||||||
if (StringUtils.isBlank(user) || StringUtils.isBlank(pass))
|
if (StringUtils.isBlank(user) || StringUtils.isBlank(pass))
|
||||||
return mapper.writeValueAsBytes(new InvalidRequestResponse());
|
return mapper.writeValueAsBytes(new InvalidRequestResponse());
|
||||||
|
|
||||||
|
if (user.length() > 24)
|
||||||
|
return mapper.writeValueAsBytes(
|
||||||
|
mapper.createObjectNode()
|
||||||
|
.put("error", "The username must be less than 24 characters")
|
||||||
|
);
|
||||||
|
|
||||||
user = user.toLowerCase();
|
user = user.toLowerCase();
|
||||||
|
|
||||||
try (Session s = DatabaseSessionFactory.createSession()) {
|
try (Session s = DatabaseSessionFactory.createSession()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user