aboutsummaryrefslogtreecommitdiff
path: root/src/api/identity.rs
diff options
context:
space:
mode:
authorMiroslav Prasil <[email protected]>2018-10-12 15:20:10 +0100
committerMiroslav Prasil <[email protected]>2018-10-12 15:20:10 +0100
commita28caa33ef48ef452aa9fb84f729a3005cc165fc (patch)
tree2dbc202ab00c02102314cec449c04af8ef8727c0 /src/api/identity.rs
parentce4fedf1913c83a3a5b2e6ce5b056e4756be5dd7 (diff)
downloadvaultwarden-a28caa33ef48ef452aa9fb84f729a3005cc165fc.tar.gz
vaultwarden-a28caa33ef48ef452aa9fb84f729a3005cc165fc.zip
Implement poor man's admin panel
Diffstat (limited to 'src/api/identity.rs')
-rw-r--r--src/api/identity.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/api/identity.rs b/src/api/identity.rs
index db62398b..f4df90c4 100644
--- a/src/api/identity.rs
+++ b/src/api/identity.rs
@@ -107,11 +107,13 @@ fn _password_login(data: &ConnectData, device_type: DeviceType, conn: DbConn, re
Some(device) => {
// Check if valid device
if device.user_uuid != user.uuid {
- device.delete(&conn);
- err!("Device is not owned by user")
+ match device.delete(&conn) {
+ Ok(()) => Device::new(device_id, user.uuid.clone(), device_name, device_type_num),
+ Err(_) => err!("Tried to delete device not owned by user, but failed")
+ }
+ } else {
+ device
}
-
- device
}
None => {
// Create new device