mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
Moved domains APIs to new Settings controller
This commit is contained in:
parent
e57964e978
commit
ce036c5e16
@ -157,13 +157,6 @@ namespace Bit.Api.Controllers
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
|
||||
[HttpGet("domains")]
|
||||
public Task<DomainsResponseModel> GetDomains()
|
||||
{
|
||||
var response = new DomainsResponseModel(_currentContext.User);
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
|
||||
[HttpPut("profile")]
|
||||
[HttpPost("profile")]
|
||||
public async Task<ProfileResponseModel> PutProfile([FromBody]UpdateProfileRequestModel model)
|
||||
@ -174,16 +167,6 @@ namespace Bit.Api.Controllers
|
||||
return response;
|
||||
}
|
||||
|
||||
[HttpPut("domains")]
|
||||
[HttpPost("domains")]
|
||||
public async Task<DomainsResponseModel> PutDomains([FromBody]UpdateDomainsRequestModel model)
|
||||
{
|
||||
await _userService.SaveUserAsync(model.ToUser(_currentContext.User));
|
||||
|
||||
var response = new DomainsResponseModel(_currentContext.User);
|
||||
return response;
|
||||
}
|
||||
|
||||
[HttpGet("two-factor")]
|
||||
public async Task<TwoFactorResponseModel> GetTwoFactor(string masterPasswordHash, TwoFactorProviderType provider)
|
||||
{
|
||||
|
43
src/Api/Controllers/SettingsController.cs
Normal file
43
src/Api/Controllers/SettingsController.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Bit.Api.Models;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
[Route("settings")]
|
||||
[Authorize("Application")]
|
||||
public class SettingsController : Controller
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly CurrentContext _currentContext;
|
||||
|
||||
public SettingsController(
|
||||
IUserService userService,
|
||||
CurrentContext currentContext)
|
||||
{
|
||||
_userService = userService;
|
||||
_currentContext = currentContext;
|
||||
}
|
||||
|
||||
[HttpGet("domains")]
|
||||
public Task<DomainsResponseModel> GetDomains()
|
||||
{
|
||||
var response = new DomainsResponseModel(_currentContext.User);
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
|
||||
[HttpPut("domains")]
|
||||
[HttpPost("domains")]
|
||||
public async Task<DomainsResponseModel> PutDomains([FromBody]UpdateDomainsRequestModel model)
|
||||
{
|
||||
await _userService.SaveUserAsync(model.ToUser(_currentContext.User));
|
||||
|
||||
var response = new DomainsResponseModel(_currentContext.User);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user