mirror of
https://github.com/bitwarden/server.git
synced 2025-05-23 04:21:05 -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:
parent
f3e3474746
commit
5de7fde685
@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Bit.Core.Identity;
|
using Bit.Core.Identity;
|
||||||
using Bit.Core.Repositories;
|
|
||||||
using Bit.Api.Models;
|
using Bit.Api.Models;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
@ -14,16 +13,13 @@ namespace Bit.Api.Controllers
|
|||||||
public class AuthController : Controller
|
public class AuthController : Controller
|
||||||
{
|
{
|
||||||
private readonly JwtBearerSignInManager _signInManager;
|
private readonly JwtBearerSignInManager _signInManager;
|
||||||
private readonly IUserRepository _userRepository;
|
|
||||||
private readonly CurrentContext _currentContext;
|
private readonly CurrentContext _currentContext;
|
||||||
|
|
||||||
public AuthController(
|
public AuthController(
|
||||||
JwtBearerSignInManager signInManager,
|
JwtBearerSignInManager signInManager,
|
||||||
IUserRepository userRepository,
|
|
||||||
CurrentContext currentContext)
|
CurrentContext currentContext)
|
||||||
{
|
{
|
||||||
_signInManager = signInManager;
|
_signInManager = signInManager;
|
||||||
_userRepository = userRepository;
|
|
||||||
_currentContext = currentContext;
|
_currentContext = currentContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Bit.Core.Domains;
|
using Bit.Core.Domains;
|
||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
|
using Bit.Core.Services;
|
||||||
|
|
||||||
namespace Bit.Core.Identity
|
namespace Bit.Core.Identity
|
||||||
{
|
{
|
||||||
@ -18,13 +19,16 @@ namespace Bit.Core.Identity
|
|||||||
IUserSecurityStampStore<User>
|
IUserSecurityStampStore<User>
|
||||||
{
|
{
|
||||||
private readonly IUserRepository _userRepository;
|
private readonly IUserRepository _userRepository;
|
||||||
|
private readonly IUserService _userService;
|
||||||
private readonly CurrentContext _currentContext;
|
private readonly CurrentContext _currentContext;
|
||||||
|
|
||||||
public UserStore(
|
public UserStore(
|
||||||
IUserRepository userRepository,
|
IUserRepository userRepository,
|
||||||
|
IUserService userService,
|
||||||
CurrentContext currentContext)
|
CurrentContext currentContext)
|
||||||
{
|
{
|
||||||
_userRepository = userRepository;
|
_userRepository = userRepository;
|
||||||
|
_userService = userService;
|
||||||
_currentContext = currentContext;
|
_currentContext = currentContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +154,7 @@ namespace Bit.Core.Identity
|
|||||||
|
|
||||||
public async Task<IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken = default(CancellationToken))
|
public async Task<IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
await _userRepository.ReplaceAsync(user);
|
await _userService.SaveUserAsync(user);
|
||||||
return IdentityResult.Success;
|
return IdentityResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ namespace Bit.Core.Services
|
|||||||
throw new ApplicationException("Use register method to create a new user.");
|
throw new ApplicationException("Use register method to create a new user.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user.RevisionDate = DateTime.UtcNow;
|
||||||
await _userRepository.ReplaceAsync(user);
|
await _userRepository.ReplaceAsync(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user