Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register Action and Address model updated #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion RunGroopWebApp/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@ public async Task<IActionResult> Register(RegisterViewModel registerViewModel)
var newUserResponse = await _userManager.CreateAsync(newUser, registerViewModel.Password);

if (newUserResponse.Succeeded)
{
await _userManager.AddToRoleAsync(newUser, UserRoles.User);
}
else
{
TempData["Error"] = "Passwords must have at least one uppercase ('A'-'Z'), " +
"one digit ('0'-'9') and one non alphanumeric character";
return View(registerViewModel);
}

return RedirectToAction("Index", "Race");
return RedirectToAction("Login", "Account");
}

[HttpGet]
Expand Down
1 change: 0 additions & 1 deletion RunGroopWebApp/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public async Task<IActionResult> Index(HomeViewModel homeVM)
{
State = userLocation.StateCode,
City = userLocation.CityName,
ZipCode = createVM.ZipCode ?? 0,
}
};

Expand Down
1 change: 0 additions & 1 deletion RunGroopWebApp/Models/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ public class Address
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public int ZipCode { get; set; }
}
}