@@ -596,7 +596,7 @@ public IActionResult Register(string returnUrl = null)
596
596
[ HttpPost ]
597
597
[ AllowAnonymous ]
598
598
[ ValidateAntiForgeryToken ]
599
- public async Task < IActionResult > Register ( RegisterViewModel model , string returnUrl = null )
599
+ public async Task < IActionResult > Register ( RegisterViewModel model , string returnUrl = null , bool IsCalledFromRegisterWithoutUsername = false )
600
600
{
601
601
returnUrl = returnUrl ?? Url . Content ( "~/" ) ;
602
602
@@ -633,7 +633,21 @@ public async Task<IActionResult> Register(RegisterViewModel model, string return
633
633
AddErrors ( result ) ;
634
634
635
635
// If we got this far, something failed, redisplay form
636
- return View ( model ) ;
636
+ if ( IsCalledFromRegisterWithoutUsername )
637
+ {
638
+ var registerWithoutUsernameModel = new RegisterWithoutUsernameViewModel
639
+ {
640
+ Email = model . Email ,
641
+ Password = model . Password ,
642
+ ConfirmPassword = model . ConfirmPassword
643
+ } ;
644
+
645
+ return View ( "RegisterWithoutUsername" , registerWithoutUsernameModel ) ;
646
+ }
647
+ else
648
+ {
649
+ return View ( model ) ;
650
+ }
637
651
}
638
652
639
653
[ HttpPost ]
@@ -649,10 +663,9 @@ public async Task<IActionResult> RegisterWithoutUsername(RegisterWithoutUsername
649
663
ConfirmPassword = model . ConfirmPassword
650
664
} ;
651
665
652
- return await Register ( registerModel , returnUrl ) ;
666
+ return await Register ( registerModel , returnUrl , true ) ;
653
667
}
654
668
655
-
656
669
/*****************************************/
657
670
/* helper APIs for the AccountController */
658
671
/*****************************************/
@@ -798,4 +811,4 @@ private async Task<LoggedOutViewModel> BuildLoggedOutViewModelAsync(string logou
798
811
return vm ;
799
812
}
800
813
}
801
- }
814
+ }
0 commit comments