mirror of
https://github.com/sphildreth/roadie
synced 2024-11-10 06:44:12 +00:00
Existing user and email error message returned on register now.
This commit is contained in:
parent
e0208212a0
commit
82544c143b
1 changed files with 12 additions and 0 deletions
|
@ -199,6 +199,18 @@ namespace Roadie.Api.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
var existinUserByUsername = await UserManager.FindByNameAsync(registerModel.Username);
|
||||
if (existinUserByUsername != null)
|
||||
{
|
||||
return StatusCode((int)HttpStatusCode.BadRequest, new { Title = "User With Username Already Exists!" });
|
||||
}
|
||||
|
||||
var existingUserByEmail = await UserManager.FindByEmailAsync(registerModel.Email);
|
||||
if(existingUserByEmail != null)
|
||||
{
|
||||
return StatusCode((int)HttpStatusCode.BadRequest, new { Title = "User With Email Already Exists!" });
|
||||
}
|
||||
|
||||
var identityResult = await UserManager.CreateAsync(user, registerModel.Password);
|
||||
if (identityResult.Succeeded)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue