This commit is contained in:
XeF2 authored and GitHub committed 2026-08-25 14:47:03 +08:00
1 parent f9fb8dcbf1
commit c25c1d5e89
2 files changed
+8 -4

No files matched your search

+6 -2
View File
@@ -303,8 +303,12 @@ class UserRegisterWithCodeHandler extends Handler {
}
async get() {
const provider = this.ctx.oauth.providers[this.tdoc.identity.provider];
this.response.template = 'user_register_with_code.html';
this.response.body = this.tdoc;
this.response.body = {
...this.tdoc,
lockUsername: !!provider?.lockUsername,
};
}
@param('password', Types.Password)
@@ -317,7 +321,7 @@ class UserRegisterWithCodeHandler extends Handler {
) {
const provider = this.ctx.oauth.providers[this.tdoc.identity.provider];
if (!provider) throw new SystemError(`OAuth provider ${this.tdoc.identity.provider} not found`);
if (provider.lockUsername) uname = this.tdoc.identity.username;
if (provider.lockUsername) uname = this.tdoc.username;
if (!Types.Username[1](uname)) throw new ValidationError('uname');
if (password !== verify) throw new VerifyPasswordError();
const randomEmail = `${randomstring(12)}@invalid.local`; // some random email to remove in the future
@@ -12,13 +12,13 @@
<div>
<label class="inverse material textbox">
{{ _('Username') }}
<input name="uname" value="{{ username or '' }}" type="text" autofocus>
<input name="uname" value="{{ username or '' }}" type="text" {% if lockUsername %}readonly{% else %}autofocus{% endif %}>
</label>
</div>
<div>
<label class="inverse material textbox">
{{ _('Password') }}
<input name="password" type="password">
<input name="password" type="password" {% if lockUsername %}autofocus{% endif %}>
</label>
</div>
<div>