mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add length check for username.
This commit is contained in:
parent
c558572953
commit
f5e881e0e4
1 changed files with 6 additions and 0 deletions
|
@ -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 a new issue