Skip to content

Commit

Permalink
Fix regression (#3667)
Browse files Browse the repository at this point in the history
  • Loading branch information
dtivel authored Mar 17, 2017
1 parent d424e79 commit 7293390
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/NuGetGallery/Authentication/AuthenticationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,18 @@ public virtual async Task GeneratePasswordResetToken(User user, int expirationIn
var passwordCredential = user.Credentials.FirstOrDefault(
credential => credential.Type.StartsWith(CredentialTypes.Password.Prefix, StringComparison.OrdinalIgnoreCase));

await Auditing.SaveAuditRecordAsync(new UserAuditRecord(user, AuditedUserAction.RequestPasswordReset, passwordCredential));
UserAuditRecord auditRecord;

if (passwordCredential == null)
{
auditRecord = new UserAuditRecord(user, AuditedUserAction.RequestPasswordReset);
}
else
{
auditRecord = new UserAuditRecord(user, AuditedUserAction.RequestPasswordReset, passwordCredential);
}

await Auditing.SaveAuditRecordAsync(auditRecord);

await Entities.SaveChangesAsync();
}
Expand Down

0 comments on commit 7293390

Please sign in to comment.