Skip to content

Commit

Permalink
added password confirmation on admin create user page
Browse files Browse the repository at this point in the history
  • Loading branch information
troygoode committed Aug 17, 2011
1 parent 0897750 commit 70c1e01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ public ActionResult CreateUser(CreateUserViewModel createUserViewModel)

try
{
if(createUserViewModel.Password != createUserViewModel.ConfirmPassword)
throw new MembershipCreateUserException("Passwords do not match.");

var user = _userService.Create(
createUserViewModel.Username,
createUserViewModel.Password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ namespace SampleWebsite.Mvc3.Areas.MvcMembership.Models.UserAdministration
{
public class CreateUserViewModel
{
[Display(Name = "User Name")]
[Required]
public string Username { get; set; }

[Required, DataType(DataType.Password)]
public string Password { get; set; }

[Display(Name = "Password (Again...)")]
[Required, DataType(DataType.Password)]
public string ConfirmPassword { get; set; }

[Display(Name = "Email Address")]
[Required, Email]
public string Email { get; set; }

Expand Down

0 comments on commit 70c1e01

Please sign in to comment.