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() {
|
||||
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>
|
||||
|
||||
Reference in new issue
Block a user