feat: rabbit and reptile feedback changes

This commit is contained in:
=
2025-05-15 00:56:53 +05:30
parent 67fc16ecd3
commit eca2b3ccde
8 changed files with 18 additions and 13 deletions
@@ -30,7 +30,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
auditLogsRetentionDays: 0, auditLogsRetentionDays: 0,
auditLogStreams: false, auditLogStreams: false,
auditLogStreamLimit: 3, auditLogStreamLimit: 3,
samlSSO: true, samlSSO: false,
hsm: false, hsm: false,
oidcSSO: false, oidcSSO: false,
scim: false, scim: false,
@@ -181,7 +181,7 @@ export const oidcConfigServiceFactory = ({
manageGroupMemberships manageGroupMemberships
}: TOidcLoginDTO) => { }: TOidcLoginDTO) => {
const serverCfg = await getServerCfg(); const serverCfg = await getServerCfg();
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
if (serverCfg.enabledLoginMethods && !serverCfg.enabledLoginMethods.includes(LoginMethod.OIDC)) { if (serverCfg.enabledLoginMethods && !serverCfg.enabledLoginMethods.includes(LoginMethod.OIDC)) {
throw new ForbiddenRequestError({ throw new ForbiddenRequestError({
@@ -110,7 +110,12 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
.default([]) .default([])
.describe(PROJECT_USERS.REMOVE_MEMBER.emails) .describe(PROJECT_USERS.REMOVE_MEMBER.emails)
.refine((val) => val.every((el) => el === el.toLowerCase()), "Email must be lowercase"), .refine((val) => val.every((el) => el === el.toLowerCase()), "Email must be lowercase"),
usernames: z.string().array().default([]).describe(PROJECT_USERS.REMOVE_MEMBER.usernames) usernames: z
.string()
.array()
.default([])
.describe(PROJECT_USERS.REMOVE_MEMBER.usernames)
.refine((val) => val.every((el) => el === el.toLowerCase()), "Username must be lowercase")
}), }),
response: { response: {
200: z.object({ 200: z.object({
@@ -723,8 +723,8 @@ export const authLoginServiceFactory = ({
} }
user = await userDAL.create({ user = await userDAL.create({
username: email.toLowerCase(), username: email.trim().toLowerCase(),
email: email.toLowerCase(), email: email.trim().toLowerCase(),
isEmailVerified: true, isEmailVerified: true,
firstName, firstName,
lastName, lastName,
@@ -73,7 +73,7 @@ export const authSignupServiceFactory = ({
}: TAuthSignupDep) => { }: TAuthSignupDep) => {
// first step of signup. create user and send email // first step of signup. create user and send email
const beginEmailSignupProcess = async (email: string) => { const beginEmailSignupProcess = async (email: string) => {
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const isEmailInvalid = await isDisposableEmail(sanitizedEmail); const isEmailInvalid = await isDisposableEmail(sanitizedEmail);
if (isEmailInvalid) { if (isEmailInvalid) {
throw new Error("Provided a disposable email"); throw new Error("Provided a disposable email");
@@ -113,7 +113,7 @@ export const authSignupServiceFactory = ({
}; };
const verifyEmailSignup = async (email: string, code: string) => { const verifyEmailSignup = async (email: string, code: string) => {
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const usersByUsername = await userDAL.findUserByUsername(sanitizedEmail); const usersByUsername = await userDAL.findUserByUsername(sanitizedEmail);
const user = const user =
usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === sanitizedEmail) : usersByUsername?.[0]; usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === sanitizedEmail) : usersByUsername?.[0];
@@ -166,7 +166,7 @@ export const authSignupServiceFactory = ({
authorization, authorization,
useDefaultOrg useDefaultOrg
}: TCompleteAccountSignupDTO) => { }: TCompleteAccountSignupDTO) => {
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const appCfg = getConfig(); const appCfg = getConfig();
const serverCfg = await getServerCfg(); const serverCfg = await getServerCfg();
@@ -415,7 +415,7 @@ export const authSignupServiceFactory = ({
encryptedPrivateKeyTag, encryptedPrivateKeyTag,
authorization authorization
}: TCompleteAccountInviteDTO) => { }: TCompleteAccountInviteDTO) => {
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const usersByUsername = await userDAL.findUserByUsername(sanitizedEmail); const usersByUsername = await userDAL.findUserByUsername(sanitizedEmail);
const user = const user =
usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === sanitizedEmail) : usersByUsername?.[0]; usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === sanitizedEmail) : usersByUsername?.[0];
@@ -272,7 +272,7 @@ export const superAdminServiceFactory = ({
userAgent userAgent
}: TAdminSignUpDTO) => { }: TAdminSignUpDTO) => {
const appCfg = getConfig(); const appCfg = getConfig();
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const existingUser = await userDAL.findOne({ username: sanitizedEmail }); const existingUser = await userDAL.findOne({ username: sanitizedEmail });
if (existingUser) throw new BadRequestError({ name: "Admin sign up", message: "User already exists" }); if (existingUser) throw new BadRequestError({ name: "Admin sign up", message: "User already exists" });
@@ -349,7 +349,7 @@ export const superAdminServiceFactory = ({
const bootstrapInstance = async ({ email, password, organizationName }: TAdminBootstrapInstanceDTO) => { const bootstrapInstance = async ({ email, password, organizationName }: TAdminBootstrapInstanceDTO) => {
const appCfg = getConfig(); const appCfg = getConfig();
const sanitizedEmail = email.toLowerCase(); const sanitizedEmail = email.trim().toLowerCase();
const serverCfg = await serverCfgDAL.findById(ADMIN_CONFIG_DB_UUID); const serverCfg = await serverCfgDAL.findById(ADMIN_CONFIG_DB_UUID);
if (serverCfg?.initialized) { if (serverCfg?.initialized) {
throw new BadRequestError({ message: "Instance has already been set up" }); throw new BadRequestError({ message: "Instance has already been set up" });
+1 -1
View File
@@ -230,7 +230,7 @@ export const userServiceFactory = ({
if (duplicatedAccounts.length && myAccount) { if (duplicatedAccounts.length && myAccount) {
await userDAL.transaction(async (tx) => { await userDAL.transaction(async (tx) => {
await userDAL.delete({ $in: { id: duplicatedAccounts?.map((el) => el.id) } }, tx); await userDAL.delete({ $in: { id: duplicatedAccounts?.map((el) => el.id) } }, tx);
await userDAL.updateById(userId, { username: myAccount.username.toLowerCase() }); await userDAL.updateById(userId, { username: myAccount.username.toLowerCase() }, tx);
}); });
} }
}; };
@@ -89,7 +89,7 @@ export const SelectOrganizationPage = () => {
</div> </div>
<div className="thin-scrollbar flex h-full max-h-60 w-full flex-col items-stretch gap-2 overflow-auto rounded-md"> <div className="thin-scrollbar flex h-full max-h-60 w-full flex-col items-stretch gap-2 overflow-auto rounded-md">
{duplicateAccounts?.data?.duplicateAccounts?.map((el) => { {duplicateAccounts?.data?.duplicateAccounts?.map((el) => {
const lastSession = el.devices.at(-1); const lastSession = el.devices?.at(-1);
return ( return (
<div <div
key={el.id} key={el.id}