fix(account): simplify signup and collapse settings

go
codex 4 weeks ago
parent 7d4b1f11f9
commit 412edda40a

@ -69,7 +69,7 @@ php xcat createAdmin
mariadb -h DB_HOST -P DB_PORT -u DB_USER -p BUSINESS_DB < /home/virt-cloud/web/sql/user_profile.sql
```
该增量文件只为当前分支的测试环境补充姓、名、手机号和地址字段,不读取或迁移已退役系统的数据。已有用户默认保留空资料,可登录后在“账户设置 → 账户信息”补齐;新注册用户必须完整填写。
该增量文件只为当前分支的测试环境补充姓、名、手机号和地址字段,不读取或迁移已退役系统的数据。注册流程不采集这些资料;新用户和已有用户均可登录后在“账户设置 → 账户信息”中补充。
若实例是在缺少 PHP 模板展示快照的早期 Go Agent 版本中创建,更新面板代码后先执行只读检查,再显式应用元数据修复:

@ -21,7 +21,6 @@ use App\Services\RegistrationIpRestriction;
use App\Services\RedisClient;
use App\Services\ReferralService;
use App\Services\TrustedLoginDeviceService;
use App\Services\UserProfileService;
use App\Models\User;
use App\Models\LoginIp;
use App\Models\EmailVerify;
@ -880,15 +879,6 @@ class AuthController extends BaseController
if (!Check::isEmailLegal($email) || strlen($email) > 254 || $name === '' || mb_strlen($name) > 128) {
return $this->echoJson($response, ['ret' => 0, 'msg' => '请填写有效的用户名和邮箱']);
}
$profileInput = [];
foreach (UserProfileService::FIELDS as $field) {
$profileInput[$field] = $read($field);
}
try {
$profile = UserProfileService::validate($profileInput);
} catch (\InvalidArgumentException $exception) {
return $this->echoJson($response, ['ret' => 0, 'msg' => $exception->getMessage()]);
}
$whitelist = RegistrationEmailWhitelist::configuredRules();
if ($whitelist['enabled'] && !RegistrationEmailWhitelist::allows($email, $whitelist['domains'])) {
return $this->echoJson($response, ['ret' => 0, 'msg' => '此邮箱暂不允许注册']);
@ -908,7 +898,7 @@ class AuthController extends BaseController
$connection = (new User())->getConnection();
try {
$connection->transaction(function () use ($read, $email, $name, $password, $code, $profile) {
$connection->transaction(function () use ($read, $email, $name, $password, $code) {
if (User::where('email', $email)->exists()) {
throw new \InvalidArgumentException('该邮箱已被注册');
}
@ -968,9 +958,6 @@ class AuthController extends BaseController
$user = new User();
$user->user_name = (new AntiXSS())->xss_clean($name);
$user->email = $email;
foreach ($profile as $field => $value) {
$user->{$field} = $value;
}
$user->pass = Hash::passwordHash($password);
$user->enable = 1;
$user->is_admin = 0;

@ -1147,17 +1147,6 @@ body.venix-auth .auth-subtitle {
line-height: 1.7;
}
body.venix-auth .auth-form { display: flex; flex-direction: column; gap: 18px; }
body.venix-auth .auth-profile-section {
display: grid;
gap: 16px;
padding: 18px;
background: var(--vu-panel-soft);
border: 1px solid var(--vu-border);
border-radius: 12px;
}
body.venix-auth .auth-profile-heading { display: grid; gap: 4px; }
body.venix-auth .auth-profile-heading strong { color: var(--vu-text); font-size: 15px; }
body.venix-auth .auth-profile-heading span { color: var(--vu-muted); font-size: 12px; line-height: 1.55; }
body.venix-auth .auth-field {
min-width: 0;
display: flex;
@ -1379,7 +1368,6 @@ body.venix-auth .auth-modal-actions {
body.venix-auth .auth-site-nav nav a { padding: 7px 8px; font-size: 12px; }
body.venix-auth .auth-shell { align-items: start; padding: 28px 14px; }
body.venix-auth .auth-panel { padding: 26px 20px; border-radius: 15px; }
body.venix-auth .auth-profile-section { padding: 16px; }
body.venix-auth .auth-panel-wide {
width: 100%;
margin-left: 0;

@ -1,4 +1,4 @@
import { initializeTaskCenter } from './task-center.js?v=2026102405';
import { initializeTaskCenter } from './task-center.js?v=2026102406';
const pageModules = Object.freeze({
instances: '/cloud/instances.js',

@ -30,56 +30,6 @@
</div>
{/if}
<div class="auth-profile-section" aria-labelledby="registrationProfileTitle">
<div class="auth-profile-heading">
<strong id="registrationProfileTitle">{if $language == 'true'}Account information{else}账户信息{/if}</strong>
<span>{if $language == 'true'}Enter the contact and address details for this account.{else}请填写账户联系人和地址信息。{/if}</span>
</div>
<div class="auth-row">
<div class="auth-field">
<label for="last_name">{if $language == 'true'}Last name{else}姓{/if}</label>
<input id="last_name" name="last_name" type="text" maxlength="80" autocomplete="family-name" required>
</div>
<div class="auth-field">
<label for="first_name">{if $language == 'true'}First name{else}名{/if}</label>
<input id="first_name" name="first_name" type="text" maxlength="80" autocomplete="given-name" required>
</div>
</div>
<div class="auth-field">
<label for="phone">{if $language == 'true'}Phone number{else}手机号{/if}</label>
<input id="phone" name="phone" type="tel" maxlength="32" autocomplete="tel" inputmode="tel" required>
</div>
<div class="auth-row">
<div class="auth-field">
<label for="country">{if $language == 'true'}Country{else}国家{/if}</label>
<input id="country" name="country" type="text" maxlength="100" autocomplete="country-name" required>
</div>
<div class="auth-field">
<label for="province">{if $language == 'true'}State / Province{else}省/州{/if}</label>
<input id="province" name="province" type="text" maxlength="100" autocomplete="address-level1" required>
</div>
</div>
<div class="auth-row">
<div class="auth-field">
<label for="city">{if $language == 'true'}City{else}城市{/if}</label>
<input id="city" name="city" type="text" maxlength="100" autocomplete="address-level2" required>
</div>
<div class="auth-field">
<label for="postal_code">{if $language == 'true'}Postal code{else}邮编{/if}</label>
<input id="postal_code" name="postal_code" type="text" maxlength="32" autocomplete="postal-code" required>
</div>
</div>
<div class="auth-field">
<label for="address">{if $language == 'true'}Street address{else}具体地址{/if}</label>
<input id="address" name="address" type="text" maxlength="255" autocomplete="street-address" required>
</div>
</div>
<div class="auth-row">
<div class="auth-field">
<label for="passwd">{if $language == 'true'}Password{else}密码{/if}</label>
@ -194,14 +144,6 @@
VenixAuth.post('/auth/register', {
email: fieldValue('email'),
name: fieldValue('name'),
last_name: fieldValue('last_name'),
first_name: fieldValue('first_name'),
phone: fieldValue('phone'),
country: fieldValue('country'),
province: fieldValue('province'),
city: fieldValue('city'),
address: fieldValue('address'),
postal_code: fieldValue('postal_code'),
aff: affCode || (Number.isInteger(affid) ? affid : ''),
passwd: fieldValue('passwd'),
repasswd: fieldValue('repasswd'),

@ -1,2 +1,2 @@
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
{assign var=venix_asset_version value='2026102405' scope='global'}
{assign var=venix_asset_version value='2026102406' scope='global'}

@ -9,7 +9,7 @@
</header>
<div class="vu-compact-stack">
<details class="vu-compact-panel" open>
<details class="vu-compact-panel">
<summary>
<span class="vu-summary-icon"><i class="mdi mdi-card-account-details-outline" aria-hidden="true"></i></span>
<span class="vu-summary-copy"><strong>账户信息</strong><small>管理联系人、电话和地址资料</small></span>

@ -99,12 +99,15 @@ $assert(str_contains($sources['routes'], "'/profile'")
&& str_contains($sources['account'], 'AdminCsrf::verify')
&& str_contains($sources['account'], 'UserProfileService::update'),
'The authenticated CSRF-protected profile API is not fully wired.');
$assert(str_contains($sources['auth'], 'UserProfileService::validate($profileInput)')
&& str_contains($sources['auth'], 'foreach ($profile as $field => $value)'),
'Registration does not validate and persist the shared profile payload.');
$assert(!str_contains($sources['auth'], 'UserProfileService')
&& !str_contains($sources['register'], 'registrationProfileTitle')
&& str_contains($sources['register'], "email: fieldValue('email')")
&& str_contains($sources['register'], "name: fieldValue('name')"),
'Registration must keep its original fields and must not collect account profile data.');
$assert(str_contains($sources['drawer'], 'id="vuProfileForm"')
&& str_contains($sources['runtime'], 'post("/user/profile", profile)'),
'The account information form is not wired to its profile API.');
&& str_contains($sources['runtime'], 'post("/user/profile", profile)')
&& preg_match('/<details\b[^>]*\bopen\b/i', $sources['drawer']) !== 1,
'The account information form is not wired correctly or a drawer card is open by default.');
$assert(preg_match('/CREATE TABLE `user` \((.*?)\) ENGINE=/s', $sources['schema'], $userTable) === 1,
'The fresh user table definition is missing.');
@ -122,10 +125,10 @@ foreach (UserProfileService::FIELDS as $field) {
$assert(str_contains($userTable[1], '`' . $field . '` ' . $columnDefinitions[$field])
&& str_contains($sources['migration'], '`' . $field . '`'),
'The user table schema is missing the profile column: ' . $field);
$assert(str_contains($sources['register'], 'name="' . $field . '"')
&& str_contains($sources['register'], $field . ": fieldValue('" . $field . "')")
$assert(!str_contains($sources['register'], 'name="' . $field . '"')
&& !str_contains($sources['register'], $field . ": fieldValue('" . $field . "')")
&& str_contains($sources['drawer'], 'name="' . $field . '"'),
'A registration or account profile field is missing: ' . $field);
'Profile data must be editable in account settings without appearing during registration: ' . $field);
}
echo "User registration and account profile checks passed.\n";
echo "User account profile and registration separation checks passed.\n";

Loading…
Cancel
Save