public HttpResponseMessage ConfirmEmail(string codeValue) { if (!_emailConfirmationService.TryAcceptConfirmation(codeValue, ConfirmationCodeType.EmailConfirmation)) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Code is not valid.")); } return(Request.CreateResponse(HttpStatusCode.OK, "Email was confirmed.")); }
public void ChangeEmail(string codeValue) { if (_emailConfirmationService.TryAcceptConfirmation(codeValue)) { var user = _confirmationCodeService.GetRelatedUser(codeValue); var newEmailValue = _confirmationCodeService.GetCodeByValue(codeValue).Email.Value; user.ChangeEmailTo(newEmailValue); _confirmationCodeService.DeactivateCode(codeValue); } else { throw new CodeIsNotValidException(codeValue); } }
public string ChangeEmail(string codeValue) { string newEmailValue; if (_emailConfirmationService.TryAcceptConfirmation(codeValue, ConfirmationCodeType.EmailChangeConfirmation)) { var user = _confirmationCodeService.GetRelatedUser(codeValue); newEmailValue = _confirmationCodeService.GetCodeByValue(codeValue).Email.Value; user.ChangeEmailTo(newEmailValue); _confirmationCodeService.DeactivateCode(codeValue); } else { throw new CodeIsNotValidException(codeValue); } return(newEmailValue); }