Merge branch 'master' into alpine

This commit is contained in:
Miroslav Prasil 2018-08-28 14:06:54 +01:00
commit 08b551624c
7 changed files with 24 additions and 3 deletions

View File

@ -4,7 +4,7 @@
####################### VAULT BUILD IMAGE ####################### ####################### VAULT BUILD IMAGE #######################
FROM node:8-alpine as vault FROM node:8-alpine as vault
ENV VAULT_VERSION "v2.1.1" ENV VAULT_VERSION "v2.2.0"
ENV URL "https://github.com/bitwarden/web.git" ENV URL "https://github.com/bitwarden/web.git"

View File

@ -1,7 +1,7 @@
--- a/src/app/services/services.module.ts --- a/src/app/services/services.module.ts
+++ b/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts
@@ -116,17 +116,15 @@ const exportService = new ExportService(folderService, cipherService, apiService @@ -120,20 +120,17 @@ const notificationsService = new NotificationsService(userService, syncService,
const importService = new ImportService(cipherService, folderService, apiService, i18nService, collectionService); const environmentService = new EnvironmentService(apiService, storageService, notificationsService);
const auditService = new AuditService(cryptoFunctionService, apiService); const auditService = new AuditService(cryptoFunctionService, apiService);
-const analytics = new Analytics(window, () => platformUtilsService.isDev() || platformUtilsService.isSelfHost(), -const analytics = new Analytics(window, () => platformUtilsService.isDev() || platformUtilsService.isSelfHost(),
@ -15,9 +15,14 @@
- const isDev = platformUtilsService.isDev(); - const isDev = platformUtilsService.isDev();
- if (!isDev && platformUtilsService.isSelfHost()) { - if (!isDev && platformUtilsService.isSelfHost()) {
- environmentService.baseUrl = window.location.origin; - environmentService.baseUrl = window.location.origin;
- } else {
- environmentService.notificationsUrl = isDev ? 'http://localhost:61840' :
- 'https://notifications.bitwarden.com'; // window.location.origin + '/notifications';
- } - }
+ const isDev = false; + const isDev = false;
+ environmentService.baseUrl = window.location.origin; + environmentService.baseUrl = window.location.origin;
+ environmentService.notificationsUrl = window.location.origin + '/notifications';
+
await apiService.setUrls({ await apiService.setUrls({
base: isDev ? null : window.location.origin, base: isDev ? null : window.location.origin,
api: isDev ? 'http://localhost:4000' : null, api: isDev ? 'http://localhost:4000' : null,

View File

@ -0,0 +1,3 @@
ALTER TABLE ciphers
ADD COLUMN
password_history TEXT;

View File

@ -112,6 +112,8 @@ struct CipherData {
Identity: Option<Value>, Identity: Option<Value>,
Favorite: Option<bool>, Favorite: Option<bool>,
PasswordHistory: Option<Value>,
} }
#[post("/ciphers/admin", data = "<data>")] #[post("/ciphers/admin", data = "<data>")]
@ -177,6 +179,7 @@ fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Head
type_data["Name"] = Value::String(data.Name.clone()); type_data["Name"] = Value::String(data.Name.clone());
type_data["Notes"] = data.Notes.clone().map(Value::String).unwrap_or(Value::Null); type_data["Notes"] = data.Notes.clone().map(Value::String).unwrap_or(Value::Null);
type_data["Fields"] = data.Fields.clone().unwrap_or(Value::Null); type_data["Fields"] = data.Fields.clone().unwrap_or(Value::Null);
type_data["PasswordHistory"] = data.PasswordHistory.clone().unwrap_or(Value::Null);
// TODO: ******* Backwards compat end ********** // TODO: ******* Backwards compat end **********
cipher.favorite = data.Favorite.unwrap_or(false); cipher.favorite = data.Favorite.unwrap_or(false);
@ -184,6 +187,7 @@ fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Head
cipher.notes = data.Notes; cipher.notes = data.Notes;
cipher.fields = data.Fields.map(|f| f.to_string()); cipher.fields = data.Fields.map(|f| f.to_string());
cipher.data = type_data.to_string(); cipher.data = type_data.to_string();
cipher.password_history = data.PasswordHistory.map(|f| f.to_string());
cipher.save(&conn); cipher.save(&conn);

View File

@ -32,6 +32,7 @@ pub struct Cipher {
pub data: String, pub data: String,
pub favorite: bool, pub favorite: bool,
pub password_history: Option<String>,
} }
/// Local methods /// Local methods
@ -55,6 +56,7 @@ impl Cipher {
fields: None, fields: None,
data: String::new(), data: String::new(),
password_history: None,
} }
} }
} }
@ -77,6 +79,10 @@ impl Cipher {
let fields_json: JsonValue = if let Some(ref fields) = self.fields { let fields_json: JsonValue = if let Some(ref fields) = self.fields {
serde_json::from_str(fields).unwrap() serde_json::from_str(fields).unwrap()
} else { JsonValue::Null }; } else { JsonValue::Null };
let password_history_json: JsonValue = if let Some(ref password_history) = self.password_history {
serde_json::from_str(password_history).unwrap()
} else { JsonValue::Null };
let mut data_json: JsonValue = serde_json::from_str(&self.data).unwrap(); let mut data_json: JsonValue = serde_json::from_str(&self.data).unwrap();
@ -108,6 +114,8 @@ impl Cipher {
"Object": "cipher", "Object": "cipher",
"Edit": true, "Edit": true,
"PasswordHistory": password_history_json,
}); });
let key = match self.type_ { let key = match self.type_ {

View File

@ -21,6 +21,7 @@ table! {
fields -> Nullable<Text>, fields -> Nullable<Text>,
data -> Text, data -> Text,
favorite -> Bool, favorite -> Bool,
password_history -> Nullable<Text>,
} }
} }