File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,8 +303,12 @@ class UserRegisterWithCodeHandler extends Handler {
303303 }
304304
305305 async get ( ) {
306+ const provider = this . ctx . oauth . providers [ this . tdoc . identity . provider ] ;
306307 this . response . template = 'user_register_with_code.html' ;
307- this . response . body = this . tdoc ;
308+ this . response . body = {
309+ ...this . tdoc ,
310+ lockUsername : ! ! provider ?. lockUsername ,
311+ } ;
308312 }
309313
310314 @param ( 'password' , Types . Password )
@@ -317,7 +321,7 @@ class UserRegisterWithCodeHandler extends Handler {
317321 ) {
318322 const provider = this . ctx . oauth . providers [ this . tdoc . identity . provider ] ;
319323 if ( ! provider ) throw new SystemError ( `OAuth provider ${ this . tdoc . identity . provider } not found` ) ;
320- if ( provider . lockUsername ) uname = this . tdoc . identity . username ;
324+ if ( provider . lockUsername ) uname = this . tdoc . username ;
321325 if ( ! Types . Username [ 1 ] ( uname ) ) throw new ValidationError ( 'uname' ) ;
322326 if ( password !== verify ) throw new VerifyPasswordError ( ) ;
323327 const randomEmail = `${ randomstring ( 12 ) } @invalid.local` ; // some random email to remove in the future
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ <h1>{{ _('Sign Up') }}</h1>
1212 < div >
1313 < label class ="inverse material textbox ">
1414 {{ _('Username') }}
15- < input name ="uname " value ="{{ username or '' }} " type ="text " autofocus >
15+ < input name ="uname " value ="{{ username or '' }} " type ="text " {% if lockUsername %}readonly{% else %} autofocus{% endif %} >
1616 </ label >
1717 </ div >
1818 < div >
1919 < label class ="inverse material textbox ">
2020 {{ _('Password') }}
21- < input name ="password " type ="password ">
21+ < input name ="password " type ="password " {% if lockUsername %}autofocus{% endif %} >
2222 </ label >
2323 </ div >
2424 < div >
You can’t perform that action at this time.
0 commit comments