1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-22 12:04:27 -05:00

updated user store to use user service for user update operation. added revision date updates to user service update method.

This commit is contained in:
Kyle Spearrin 2016-02-21 00:56:48 -05:00
parent f3e3474746
commit 5de7fde685
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Bit.Core.Identity;
using Bit.Core.Repositories;
using Bit.Api.Models;
using Microsoft.AspNet.Authorization;
using Bit.Core.Exceptions;
@ -14,16 +13,13 @@ namespace Bit.Api.Controllers
public class AuthController : Controller
{
private readonly JwtBearerSignInManager _signInManager;
private readonly IUserRepository _userRepository;
private readonly CurrentContext _currentContext;
public AuthController(
JwtBearerSignInManager signInManager,
IUserRepository userRepository,
CurrentContext currentContext)
{
_signInManager = signInManager;
_userRepository = userRepository;
_currentContext = currentContext;
}

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Bit.Core.Domains;
using Bit.Core.Repositories;
using Bit.Core.Services;
namespace Bit.Core.Identity
{
@ -18,13 +19,16 @@ namespace Bit.Core.Identity
IUserSecurityStampStore<User>
{
private readonly IUserRepository _userRepository;
private readonly IUserService _userService;
private readonly CurrentContext _currentContext;
public UserStore(
IUserRepository userRepository,
IUserService userService,
CurrentContext currentContext)
{
_userRepository = userRepository;
_userService = userService;
_currentContext = currentContext;
}
@ -150,7 +154,7 @@ namespace Bit.Core.Identity
public async Task<IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken = default(CancellationToken))
{
await _userRepository.ReplaceAsync(user);
await _userService.SaveUserAsync(user);
return IdentityResult.Success;
}

View File

@ -70,6 +70,7 @@ namespace Bit.Core.Services
throw new ApplicationException("Use register method to create a new user.");
}
user.RevisionDate = DateTime.UtcNow;
await _userRepository.ReplaceAsync(user);
}