1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 21:18:13 -05:00

Updates for devices

This commit is contained in:
Kyle Spearrin 2016-06-21 22:17:31 -04:00
parent a07a682831
commit 0e6fd21805
4 changed files with 7 additions and 1 deletions

View File

@ -23,7 +23,7 @@ namespace Bit.Api.Models
{ {
return ToDevice(new Device return ToDevice(new Device
{ {
UserId = new Guid(userId) UserId = userId == null ? default(Guid) : new Guid(userId)
}); });
} }

View File

@ -74,6 +74,7 @@ namespace Bit.Core.Identity
var existingDevice = await _deviceRepository.GetByIdentifierAsync(device.Identifier, user.Id); var existingDevice = await _deviceRepository.GetByIdentifierAsync(device.Identifier, user.Id);
if(existingDevice == null) if(existingDevice == null)
{ {
device.UserId = user.Id;
await _deviceRepository.CreateAsync(device); await _deviceRepository.CreateAsync(device);
} }
} }

View File

@ -3,6 +3,7 @@
@UserId UNIQUEIDENTIFIER, @UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50), @Name NVARCHAR(50),
@Type TINYINT, @Type TINYINT,
@Identifier NVARCHAR(50),
@PushToken NVARCHAR(255), @PushToken NVARCHAR(255),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7) @RevisionDate DATETIME2(7)
@ -16,6 +17,7 @@ BEGIN
[UserId], [UserId],
[Name], [Name],
[Type], [Type],
[Identifier],
[PushToken], [PushToken],
[CreationDate], [CreationDate],
[RevisionDate] [RevisionDate]
@ -26,6 +28,7 @@ BEGIN
@UserId, @UserId,
@Name, @Name,
@Type, @Type,
@Identifier,
@PushToken, @PushToken,
@CreationDate, @CreationDate,
@RevisionDate @RevisionDate

View File

@ -3,6 +3,7 @@
@UserId UNIQUEIDENTIFIER, @UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50), @Name NVARCHAR(50),
@Type TINYINT, @Type TINYINT,
@Identifier NVARCHAR(50),
@PushToken NVARCHAR(255), @PushToken NVARCHAR(255),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7) @RevisionDate DATETIME2(7)
@ -16,6 +17,7 @@ BEGIN
[UserId] = @UserId, [UserId] = @UserId,
[Name] = @Name, [Name] = @Name,
[Type] = @Type, [Type] = @Type,
[Identifier] = @Identifier,
[PushToken] = @PushToken, [PushToken] = @PushToken,
[CreationDate] = @CreationDate, [CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate [RevisionDate] = @RevisionDate