mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
Added POST route endpoints for all PUT and DELETE operations to allow for vault to avoid preflight.
This commit is contained in:
parent
0620fb7a86
commit
54696aade4
@ -74,6 +74,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("email")]
|
[HttpPut("email")]
|
||||||
|
[HttpPost("email")]
|
||||||
public async Task PutEmail([FromBody]EmailRequestModel model)
|
public async Task PutEmail([FromBody]EmailRequestModel model)
|
||||||
{
|
{
|
||||||
// NOTE: It is assumed that the eventual repository call will make sure the updated
|
// NOTE: It is assumed that the eventual repository call will make sure the updated
|
||||||
@ -103,6 +104,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("password")]
|
[HttpPut("password")]
|
||||||
|
[HttpPost("password")]
|
||||||
public async Task PutPassword([FromBody]PasswordRequestModel model)
|
public async Task PutPassword([FromBody]PasswordRequestModel model)
|
||||||
{
|
{
|
||||||
// NOTE: It is assumed that the eventual repository call will make sure the updated
|
// NOTE: It is assumed that the eventual repository call will make sure the updated
|
||||||
@ -130,6 +132,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("security-stamp")]
|
[HttpPut("security-stamp")]
|
||||||
|
[HttpPost("security-stamp")]
|
||||||
public async Task PutSecurityStamp([FromBody]SecurityStampRequestModel model)
|
public async Task PutSecurityStamp([FromBody]SecurityStampRequestModel model)
|
||||||
{
|
{
|
||||||
var result = await _userService.RefreshSecurityStampAsync(_currentContext.User, model.MasterPasswordHash);
|
var result = await _userService.RefreshSecurityStampAsync(_currentContext.User, model.MasterPasswordHash);
|
||||||
@ -155,6 +158,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("profile")]
|
[HttpPut("profile")]
|
||||||
|
[HttpPost("profile")]
|
||||||
public async Task<ProfileResponseModel> PutProfile([FromBody]UpdateProfileRequestModel model)
|
public async Task<ProfileResponseModel> PutProfile([FromBody]UpdateProfileRequestModel model)
|
||||||
{
|
{
|
||||||
await _userService.SaveUserAsync(model.ToUser(_currentContext.User));
|
await _userService.SaveUserAsync(model.ToUser(_currentContext.User));
|
||||||
@ -180,6 +184,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("two-factor")]
|
[HttpPut("two-factor")]
|
||||||
|
[HttpPost("two-factor")]
|
||||||
public async Task<TwoFactorResponseModel> PutTwoFactor([FromBody]UpdateTwoFactorRequestModel model)
|
public async Task<TwoFactorResponseModel> PutTwoFactor([FromBody]UpdateTwoFactorRequestModel model)
|
||||||
{
|
{
|
||||||
var user = _currentContext.User;
|
var user = _currentContext.User;
|
||||||
|
@ -71,6 +71,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}/favorite")]
|
[HttpPut("{id}/favorite")]
|
||||||
|
[HttpPost("{id}/favorite")]
|
||||||
public async Task Favorite(string id)
|
public async Task Favorite(string id)
|
||||||
{
|
{
|
||||||
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
@ -85,6 +86,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[HttpPost("{id}/delete")]
|
||||||
public async Task Delete(string id)
|
public async Task Delete(string id)
|
||||||
{
|
{
|
||||||
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var cipher = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
|
@ -72,6 +72,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[HttpPost("{id}")]
|
||||||
public async Task<DeviceResponseModel> Put(string id, [FromBody]DeviceRequestModel model)
|
public async Task<DeviceResponseModel> Put(string id, [FromBody]DeviceRequestModel model)
|
||||||
{
|
{
|
||||||
var device = await _deviceRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var device = await _deviceRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
@ -87,6 +88,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("identifier/{identifier}/token")]
|
[HttpPut("identifier/{identifier}/token")]
|
||||||
|
[HttpPost("identifier/{identifier}/token")]
|
||||||
public async Task<DeviceResponseModel> PutToken(string identifier, [FromBody]DeviceTokenRequestModel model)
|
public async Task<DeviceResponseModel> PutToken(string identifier, [FromBody]DeviceTokenRequestModel model)
|
||||||
{
|
{
|
||||||
var device = await _deviceRepository.GetByIdentifierAsync(identifier, new Guid(_userManager.GetUserId(User)));
|
var device = await _deviceRepository.GetByIdentifierAsync(identifier, new Guid(_userManager.GetUserId(User)));
|
||||||
@ -102,6 +104,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[HttpPost("{id}/delete")]
|
||||||
public async Task Delete(string id)
|
public async Task Delete(string id)
|
||||||
{
|
{
|
||||||
var device = await _deviceRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var device = await _deviceRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
|
@ -60,6 +60,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[HttpPost("{id}")]
|
||||||
public async Task<FolderResponseModel> Put(string id, [FromBody]FolderRequestModel model)
|
public async Task<FolderResponseModel> Put(string id, [FromBody]FolderRequestModel model)
|
||||||
{
|
{
|
||||||
var folder = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var folder = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
@ -73,6 +74,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[HttpPost("{id}/delete")]
|
||||||
public async Task Delete(string id)
|
public async Task Delete(string id)
|
||||||
{
|
{
|
||||||
var folder = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var folder = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
|
@ -66,6 +66,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
|
[HttpPost("{id}")]
|
||||||
public async Task<SiteResponseModel> Put(string id, [FromBody]SiteRequestModel model, string[] expand = null)
|
public async Task<SiteResponseModel> Put(string id, [FromBody]SiteRequestModel model, string[] expand = null)
|
||||||
{
|
{
|
||||||
var site = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var site = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
@ -82,6 +83,7 @@ namespace Bit.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id}")]
|
[HttpDelete("{id}")]
|
||||||
|
[HttpPost("{id}/delete")]
|
||||||
public async Task Delete(string id)
|
public async Task Delete(string id)
|
||||||
{
|
{
|
||||||
var site = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
var site = await _cipherRepository.GetByIdAsync(new Guid(id), new Guid(_userManager.GetUserId(User)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user