mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
2 files changed
+8
-4
No files matched your search
@@ -303,8 +303,12 @@ class UserRegisterWithCodeHandler extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async get() {
|
async get() {
|
||||||
|
const provider = this.ctx.oauth.providers[this.tdoc.identity.provider];
|
||||||
this.response.template = 'user_register_with_code.html';
|
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)
|
@param('password', Types.Password)
|
||||||
@@ -317,7 +321,7 @@ class UserRegisterWithCodeHandler extends Handler {
|
|||||||
) {
|
) {
|
||||||
const provider = this.ctx.oauth.providers[this.tdoc.identity.provider];
|
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) 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 (!Types.Username[1](uname)) throw new ValidationError('uname');
|
||||||
if (password !== verify) throw new VerifyPasswordError();
|
if (password !== verify) throw new VerifyPasswordError();
|
||||||
const randomEmail = `${randomstring(12)}@invalid.local`; // some random email to remove in the future
|
const randomEmail = `${randomstring(12)}@invalid.local`; // some random email to remove in the future
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="inverse material textbox">
|
<label class="inverse material textbox">
|
||||||
{{ _('Username') }}
|
{{ _('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>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="inverse material textbox">
|
<label class="inverse material textbox">
|
||||||
{{ _('Password') }}
|
{{ _('Password') }}
|
||||||
<input name="password" type="password">
|
<input name="password" type="password" {% if lockUsername %}autofocus{% endif %}>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in new issue
Block a user