15 Commits (df0f7f047ac9743e7ea9690770dc1df416de825c)

Author SHA1 Message Date
veypi df0f7f047a refactor: Rename Config to Global and simplify app initialization
- Rename cfg.Config to cfg.Global for consistency
    - Simplify cli/main.go to use vbase.App.Run() pattern
    - Update init.go to create app with vigo.New and Init function
    - Update all references from cfg.Config to cfg.Global across api, libs, models, and tests
    - Fix VBase constructor parameter order in ui/vbase.js
    - Update ui/env.js to use new VBase('vb', '/') initialization
5 days ago
veypi c588962485 fix: Add input validation and OAuth client access control
- Add username validation (required, 3-50 chars, alphanumeric + underscore)
    - Add password validation (required, minimum 8 characters)
    - Add email format validation using regex
    - Add owner check in OAuth client update and delete operations
    - Allow admin users with wildcard permission to access all organizations
7 days ago
veypi fba42193cf feat(api): Enhance /auth/me endpoint with permissions and roles
- Add UserPermissionInfo and UserInfoWithPerms structs for detailed user info
    - Extend /auth/me to return user permissions and global roles
    - Remove unused isAdmin helper method from auth.go
    - Update updateMe to return UserInfoWithPerms for consistency
7 days ago
veypi b0322047cd feat: Restrict user APIs to admins and add public user search
- Add /api/auth/users endpoint for authenticated users to search other users
    - Only return public info (id, username, nickname, avatar) in search results
    - Change /api/user routes to require user:admin permission instead of user:read
    - Update auth tests to use /api/auth/me for self updates
    - Add tests for new user search endpoint
1 week ago
veypi f7c4f1ee86 test: improve test stability and documentation
- Add 'clean_run.sh' script to reset database and restart server for clean test environment
    - Update 'README.md' with detailed troubleshooting guide and pitfalls
    - Add '04_org_load_middleware.sh' to test LoadOrg middleware functionality
    - Update 'run_all.sh' to include new middleware test
    - Fix BASE_URL handling in 'lib.sh' and test scripts to support custom environments
    - Update '02_resource_perm.sh' to fix admin permission checks
    - Remove debug logging from 'auth.go'
1 week ago
veypi 69efc4284b fix(api/oauth): encrypt ClientSecret in database
Encrypt OAuth Provider ClientSecret before storing in database to prevent
sensitive credential exposure in case of database breach.

- Encrypt ClientSecret on create using cfg.Config.Key.Encrypt()
- Encrypt ClientSecret on update when provided
- Decrypt ClientSecret before use in OAuth token exchange
- Add AES-GCM encryption/decryption functions to crypto package
- Gracefully handle legacy plaintext secrets during transition
1 week ago
veypi 4a316e6d67 fix(api/auth): reset count variable before uniqueness checks
Fix a bug where the count variable was not reset before checking
email and phone uniqueness. This could cause false positives if
a previous check had count > 0, incorrectly reporting that email
or phone already exists when they don't.

- Reset count to 0 before email check
- Reset count to 0 before phone check
1 week ago
veypi 23c7f6cb7a refactor(auth): 重构认证系统,支持多种验证方式和 OAuth 提供商管理
- 新增验证模块(api/verification),统一处理短信和邮件验证码发送
    - 新增邮件发送功能(libs/email),支持 SMTP 协议
    - 重构短信模块(libs/sms),简化阿里云和腾讯云短信接口
    - 新增 OAuth 提供商管理 API(api/oauth/providers),支持 CRUD 操作
    - 新增系统设置管理 API(api/settings),支持动态配置更新
    - 重构认证方式管理(api/auth/methods),支持启用/禁用多种登录方式
    - 删除旧的 sms_providers 和 sms API 模块,迁移至新验证体系
    - 新增数据库模型:verification、email、oauth_provider、oauth_templates、setting
    - 更新配置文档,增加新功能的使用说明
1 week ago
veypi 37acea3420 feat: 实现组织成员角色管理功能 1 week ago
veypi 178fa755d4 refactor: 重构认证模型和数据库结构 1 week ago
veypi 8b2a1aba3b refactor: 统一API错误类型处理 1 week ago
veypi 5daab97008 fix bug 1 week ago
veypi 52f2ae35ab upgrade new version 1 week ago
veypi 17f81f6a2a del old file 2 years ago
veypi 5efcf47351 添加权限角色编辑 4 years ago