Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public JsonResult ChangePassword
- (string username, string currentPassword, string newPassword)
- {
- switch (this.membershipService.ValidateLogin(username, currentPassword))
- {
- case UserValidationResult.BasUsername:
- case UserValidationResult.BadPassword:
- // abort: return JsonResult with localized error message
- // for invalid username/pass combo.
- case UserValidationResult.TrialExpired
- // abort: return JsonResult with localized error message
- // that user cannot login because their trial period has expired
- case UserValidationResult.Success:
- break;
- }
- // NOW change password now that user is validated
- }
- enum UserValidationResult
- {
- BadUsername,
- BadPassword,
- TrialExpired,
- Success
- }
- public JsonResult ChangePassword
- (string username, string currentPassword, string newPassword)
- {
- switch (this.membershipService.ValidateLogin(username, currentPassword))
- {
- case UserValidationResult.BasUsername:
- case UserValidationResult.BadPassword:
- // abort: return JsonResult with localized error message
- // for invalid username/pass combo.
- case UserValidationResult.TrialExpired
- // abort: return JsonResult with localized error message
- // that user cannot login because their trial period has expired
- case UserValidationResult.Success:
- break;
- default:
- throw new NotImplementedException
- ("Unrecognized UserValidationResult value.");
- // or NotSupportedException()
- break;
- }
- // Change password now that user is validated
- }
- enum UserValidationResult
- {
- BadUsername,
- BadPassword,
- TrialExpired,
- ContactUs,
- Success
- }
- if( i == 0 ) {
- } else { // i > 0
- }
- if( i == 0 ) {
- } else if ( i > 0 ) {
- } else {
- // i < 0 is now an enforced error
- throw new Illegal(...)
- }
- if( i == 0 ) {
- } else { // i != 0
- // we can handle both positve or negative, just not zero
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement