Restyle login, change password works

This commit is contained in:
2012-12-22 10:48:34 -05:00
parent f129142dab
commit c1944f6262
54 changed files with 327 additions and 255 deletions
@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace MileageTraker.Web.ViewModels.Account
{
public class ChangePasswordViewModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
+21
View File
@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using MileageTraker.Web.Utility;
namespace MileageTraker.Web.ViewModels.Account
{
public class LoginViewModel
{
[Required]
[Display(Name = "Email Address")]
public string EmailAddress { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Display(Name = "Remember me?")]
[NoEditLabel]
public bool RememberMe { get; set; }
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace MileageTraker.Web.ViewModels.Account
{
public class RegisterModel
{
[Required]
[Display(Name = "User name")]
public string UserName { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
-57
View File
@@ -1,57 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace MileageTraker.Web.ViewModels
{
public class ChangePasswordViewModel
{
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm new password")]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
public class LoginViewModel
{
[Required]
[Display(Name = "Email Address")]
public string EmailAddress { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
}
public class RegisterModel
{
[Required]
[Display(Name = "User name")]
public string UserName { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
@@ -3,7 +3,7 @@ using AutoMapper;
using MileageTraker.Web.DAL;
using MileageTraker.Web.Utility;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.CreateLog
{
public class ConfirmCreateLogViewModel : CreateLogViewModel
{
@@ -7,7 +7,7 @@ using MileageTraker.Web.DAL;
using MileageTraker.Web.Models;
using MileageTraker.Web.Utility;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.CreateLog
{
public class CreateLogViewModel : IValidatableObject
{
@@ -66,8 +66,8 @@ namespace MileageTraker.Web.ViewModels
Mapper.CreateMap<string, int>().ConvertUsing(Convert.ToInt32);
Mapper.CreateMap<string, double>().ConvertUsing(Convert.ToDouble);
Mapper.CreateMap<string, DateTime>().ConvertUsing(new DateTimeTypeConverter());
Mapper.CreateMap<CreateLogViewModel, Log>();
Mapper.CreateMap<Log, CreateLogViewModel>()
Mapper.CreateMap<CreateLogViewModel, Models.Log>();
Mapper.CreateMap<Models.Log, CreateLogViewModel>()
.ForMember(vm => vm.Date, opt => opt.MapFrom(m => m.Date.ToString("d")));
}
@@ -75,14 +75,14 @@ namespace MileageTraker.Web.ViewModels
{
}
public CreateLogViewModel(Log log)
public CreateLogViewModel(Models.Log log)
{
Mapper.Map(log, this);
}
public Log GetLog()
public Models.Log GetLog()
{
var log = new Log();
var log = new Models.Log();
Mapper.Map(this, log);
return log;
}
+1 -2
View File
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels
{
@@ -10,7 +9,7 @@ namespace MileageTraker.Web.ViewModels
public string EmployeeName { get; set; }
public int Miles { get; set; }
public double GasPurchased { get; set; }
public IEnumerable<Tuple<Log, Log>> LogPairs { get; set; }
public IEnumerable<Tuple<Models.Log, Models.Log>> LogPairs { get; set; }
public int TripCount { get { return LogPairs.Count(); } }
}
}
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using MileageTraker.Web.ViewModels.Log;
namespace MileageTraker.Web.ViewModels
{
@@ -2,7 +2,7 @@ using System;
using AutoMapper;
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Log
{
public class LogIndexViewModel
{
@@ -29,10 +29,10 @@ namespace MileageTraker.Web.ViewModels
static LogIndexViewModel()
{
Mapper.CreateMap<Log, LogIndexViewModel>();
Mapper.CreateMap<Models.Log, LogIndexViewModel>();
}
public LogIndexViewModel(Log log, Log previousLog)
public LogIndexViewModel(Models.Log log, Models.Log previousLog)
{
Mapper.Map(log, this);
if (previousLog != null)
@@ -4,7 +4,7 @@ using System.Web.Mvc;
using AutoMapper;
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Log
{
public class LogPartialDetails
{
@@ -33,13 +33,13 @@ namespace MileageTraker.Web.ViewModels
static LogPartialDetails()
{
Mapper.CreateMap<Log, LogPartialDetails>();
Mapper.CreateMap<Models.Log, LogPartialDetails>();
}
public LogPartialDetails()
{}
public LogPartialDetails(Log log)
public LogPartialDetails(Models.Log log)
{
Mapper.Map(log, this);
}
@@ -1,6 +1,6 @@
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Log
{
public class LogQueryViewModel
{
@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Log
{
public class LogResultsViewModel
{
@@ -1,9 +1,8 @@
using System;
using System.Linq;
using System.Collections.Generic;
using MileageTraker.Web.Models;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Vehicle
{
public class VehicleMileageItem
{
@@ -11,7 +10,7 @@ namespace MileageTraker.Web.ViewModels
public int Miles { get; set; }
public double GasPurchased { get; set; }
public string Prog { get; set; }
public IEnumerable<Tuple<Log, Log>> LogPairs { get; set; }
public IEnumerable<Tuple<Models.Log, Models.Log>> LogPairs { get; set; }
public int TripCount { get { return LogPairs.Count(); } }
}
}
@@ -1,7 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using MileageTraker.Web.ViewModels.Log;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Vehicle
{
public class VehicleMileageViewModel
{
@@ -1,9 +1,7 @@
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using MileageTraker.Web.Models;
using MileageTraker.Web.Utility;
namespace MileageTraker.Web.ViewModels
namespace MileageTraker.Web.ViewModels.Vehicle
{
public class VehiclePartialDetails
{
@@ -33,13 +31,13 @@ namespace MileageTraker.Web.ViewModels
static VehiclePartialDetails()
{
Mapper.CreateMap<Vehicle, VehiclePartialDetails>();
Mapper.CreateMap<Models.Vehicle, VehiclePartialDetails>();
}
public VehiclePartialDetails()
{}
public VehiclePartialDetails(Vehicle vehicle)
public VehiclePartialDetails(Models.Vehicle vehicle)
{
Mapper.Map(vehicle, this);
}