Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1f0e92a
Fix upgrade not redirecting the user correctly
Feb 4, 2025
5b9eeaf
Fix minor inconsistancy
Feb 4, 2025
79b8584
Update email service
Feb 5, 2025
d17d3f3
Implement mobile user support
Feb 5, 2025
130b728
Update create_test_users.sql
Feb 5, 2025
d5073ff
Delete settings for SA
Feb 5, 2025
daa2465
Enforce 2FA for admin and super admin, update view account to display…
Feb 5, 2025
4c17ca6
Implement share recipient via email, fix corrupted file with share fi…
Feb 9, 2025
b3940eb
Implement email verification for share file
Feb 9, 2025
37b030f
Implement unarchive file and mass unarchive file backend and frontend
Feb 9, 2025
bdf0cd6
Fix redirection issue with dashboard page after file deletion
Feb 9, 2025
d751669
Fix billing cycle loading issue on Settings
Feb 9, 2025
cc51fc4
Fix drag and drop issue for single upload
Feb 9, 2025
b4854ed
Implement multi selection on Folders and visual upgrade
Feb 9, 2025
ecdf075
Fix server master key generation
Feb 12, 2025
adf1f99
Fix 2FA enable button and add new disable flow ( now required 2FA cod…
Feb 12, 2025
3c9a669
Fix selected items not cleared, add auto close action after download,…
Feb 12, 2025
e2b83ae
Delete empty table
Feb 12, 2025
4a07c9a
Implement 2FA verification for enable 2FA
Feb 12, 2025
d897097
Update DownloadFileAction.js
Feb 12, 2025
0e24c1f
Delete key rotation, display account locked error, cant reuse old pw
Feb 13, 2025
a5c450b
Fix login frontend
Feb 13, 2025
b48aa55
Fix issue with checkbox
Feb 13, 2025
adb8104
Implement edit billing details
Feb 14, 2025
8e3dc2d
Implement view billing records for admin
Feb 14, 2025
d19b580
Fix pending issues with feedback and report
Feb 14, 2025
7474923
Fix auth not updating last login when 2FA is enable, fix system logs…
Feb 14, 2025
b7afc68
Implement auto unlock accounts
Feb 14, 2025
4ef3cf5
Add details to system logs
Feb 14, 2025
3761678
Update Recent viewed users to recent updated users
Feb 14, 2025
7102b48
Update SystemLogs.js
Feb 14, 2025
5d49357
Update feedback.go
Feb 15, 2025
a91f0ab
Update SharedFileAccess.js
Feb 15, 2025
bb98a90
closure popup
Feb 22, 2025
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
20 changes: 3 additions & 17 deletions backend/controllers/EndUser/MassUploadFileController.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func NewMassUploadFileController(
func (c *MassUploadFileController) MassUpload(ctx *gin.Context) {
log.Printf("Starting mass file upload request")

// Get current user
user, exists := ctx.Get("user")
if !exists {
ctx.JSON(http.StatusUnauthorized, gin.H{"status": "error", "error": "Unauthorized access"})
Expand All @@ -100,7 +99,6 @@ func (c *MassUploadFileController) MassUpload(ctx *gin.Context) {
return
}

// Parse form
form, err := ctx.MultipartForm()
if err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{"status": "error", "error": "Failed to parse form"})
Expand All @@ -113,7 +111,6 @@ func (c *MassUploadFileController) MassUpload(ctx *gin.Context) {
return
}

// Get encryption parameters
encryptionType := services.EncryptionType(ctx.DefaultPostForm("encryption_type", string(services.StandardEncryption)))
if err := c.validateEncryptionType(encryptionType, currentUser); err != nil {
ctx.JSON(http.StatusBadRequest, gin.H{
Expand All @@ -123,7 +120,6 @@ func (c *MassUploadFileController) MassUpload(ctx *gin.Context) {
return
}

// Parse parameters
nShares := c.parseIntParam(ctx, "shares", 5)
threshold := c.parseIntParam(ctx, "threshold", 3)
dataShards := c.parseIntParam(ctx, "data_shards", 4)
Expand Down Expand Up @@ -170,27 +166,24 @@ func (c *MassUploadFileController) MassUpload(ctx *gin.Context) {
wg.Add(1)
go func(fh *multipart.FileHeader) {
defer wg.Done()
semaphore <- struct{}{} // Acquire semaphore
defer func() { <-semaphore }() // Release semaphore
semaphore <- struct{}{}
defer func() { <-semaphore }()

result := c.processUpload(ctx, fh, currentUser, folderID, uploadParams)
results <- result
}(fileHeader)
}

// Wait for all uploads to complete
go func() {
wg.Wait()
close(results)
}()

// Collect results
uploadResults := make([]UploadResult, 0, len(files))
for result := range results {
uploadResults = append(uploadResults, result)
}

// Return results
ctx.JSON(http.StatusOK, gin.H{
"status": "success",
"message": "Mass file upload processing complete",
Expand Down Expand Up @@ -352,7 +345,6 @@ func (c *MassUploadFileController) createFileRecord(
return nil, fmt.Errorf("serverKey is nil")
}

// Create encoded filename
encryptedFileName := base64.RawURLEncoding.EncodeToString([]byte(fileHeader.Filename))

return &models.File{
Expand Down Expand Up @@ -433,7 +425,6 @@ func (c *MassUploadFileController) handleFolderAssignment(ctx *gin.Context, user
}
parsedID := uint(id)

// Verify folder exists and belongs to user - use GetFolderByID instead of GetFolder
folder, err := c.folderModel.GetFolderByID(parsedID, user.ID)
if err != nil {
log.Printf("Folder not found or access denied: %v", err)
Expand All @@ -442,7 +433,6 @@ func (c *MassUploadFileController) handleFolderAssignment(ctx *gin.Context, user
return &folder.ID
}

// Try to find or create "My Files" folder
folders, err := c.folderModel.GetUserFolders(user.ID)
if err != nil {
log.Printf("Failed to get user folders: %v", err)
Expand Down Expand Up @@ -515,7 +505,6 @@ func (c *MassUploadFileController) getFileInfo(file *models.File, params *Upload
}
}

// Error types for mass upload
type UploadError struct {
Code string `json:"code"`
Message string `json:"message"`
Expand All @@ -534,10 +523,8 @@ func newUploadError(code, message string, details string) *UploadError {
}
}

// Additional helper methods for handling large uploads
func (c *MassUploadFileController) calculateBatchSize(fileCount int) int {
// Calculate optimal batch size based on available system resources
// Default to 5 concurrent uploads, but adjust based on file count

if fileCount <= 5 {
return fileCount
}
Expand All @@ -551,7 +538,6 @@ func (c *MassUploadFileController) validateTotalSize(files []*multipart.FileHead
var totalSize int64
for _, file := range files {
totalSize += file.Size
// Individual file size limit (e.g., 2GB)
if file.Size > 2<<30 {
return 0, newUploadError(
"FILE_TOO_LARGE",
Expand Down
5 changes: 0 additions & 5 deletions backend/controllers/EndUser/PasswordResetController.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
type PasswordResetController struct {
userModel *models.UserModel
passwordHistoryModel *models.PasswordHistoryModel
keyRotationModel *models.KeyRotationModel
keyFragmentModel *models.KeyFragmentModel
fileModel *models.FileModel
}
Expand All @@ -25,14 +24,12 @@ type PasswordResetRequest struct {
func NewPasswordResetController(
userModel *models.UserModel,
passwordHistoryModel *models.PasswordHistoryModel,
keyRotationModel *models.KeyRotationModel,
keyFragmentModel *models.KeyFragmentModel,
fileModel *models.FileModel,
) *PasswordResetController {
return &PasswordResetController{
userModel: userModel,
passwordHistoryModel: passwordHistoryModel,
keyRotationModel: keyRotationModel,
keyFragmentModel: keyFragmentModel,
fileModel: fileModel,
}
Expand Down Expand Up @@ -63,7 +60,6 @@ func (c *PasswordResetController) ResetPassword(ctx *gin.Context) {
return
}

// Call the model method to handle all database operations
err := c.userModel.ResetPasswordWithFragments(
endUser.ID,
req.CurrentPassword,
Expand All @@ -76,7 +72,6 @@ func (c *PasswordResetController) ResetPassword(ctx *gin.Context) {
if err != nil {
log.Printf("Password reset failed for user %d: %v", endUser.ID, err)

// Map common errors to appropriate HTTP status codes
status := http.StatusInternalServerError
switch err.Error() {
case "current password is incorrect":
Expand Down
Loading