这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { EventLogs } = require("./eventLogs");
*/

const User = {
usernameRegex: new RegExp(/^[a-z0-9_\-.]+$/),
usernameRegex: new RegExp(/^[a-zA-Z0-9._%+-@]+$/),
writable: [
// Used for generic updates so we can validate keys in request body
"username",
Expand Down Expand Up @@ -95,7 +95,7 @@ const User = {
// Do not allow new users to bypass validation
if (!this.usernameRegex.test(username))
throw new Error(
"Username must only contain lowercase letters, periods, numbers, underscores, and hyphens with no spaces"
"Username must only contain letters, numbers, periods, underscores, hyphens, and email characters (@, %, +, -) with no spaces"
);

const bcrypt = require("bcrypt");
Expand Down Expand Up @@ -175,7 +175,7 @@ const User = {
return {
success: false,
error:
"Username must only contain lowercase letters, periods, numbers, underscores, and hyphens with no spaces",
"Username must only contain letters, numbers, periods, underscores, hyphens, and email characters (@, %, +, -) with no spaces",
};

const user = await prisma.users.update({
Expand Down