1
0
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:
Kyle Spearrin 2017-01-10 21:39:25 -05:00
parent e57964e978
commit ce036c5e16
3 changed files with 43 additions and 17 deletions

View File

@ -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)
{

View 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;
}
}
}