1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-08-22 10:45:26 +00:00

Merge branch 'duo'

This commit is contained in:
Daniel García 2019-04-14 22:02:55 +02:00
commit bf20355c5e
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
16 changed files with 605 additions and 131 deletions

View file

@ -72,9 +72,7 @@ use crate::error::MapResult;
/// Database methods
impl Cipher {
pub fn to_json(&self, host: &str, user_uuid: &str, conn: &DbConn) -> Value {
use super::Attachment;
use crate::util::format_date;
use serde_json;
let attachments = Attachment::find_by_cipher(&self.uuid, conn);
let attachments_json: Vec<Value> = attachments.iter().map(|c| c.to_json(host)).collect();

View file

@ -119,8 +119,6 @@ use crate::error::MapResult;
/// Database methods
impl User {
pub fn to_json(&self, conn: &DbConn) -> Value {
use super::{TwoFactor, UserOrganization};
let orgs = UserOrganization::find_by_user(&self.uuid, conn);
let orgs_json: Vec<Value> = orgs.iter().map(|c| c.to_json(&conn)).collect();
let twofactor_enabled = !TwoFactor::find_by_user(&self.uuid, conn).is_empty();