Skip to content

Commit

Permalink
Merge pull request #1153 from erikaperugachi/enterprise
Browse files Browse the repository at this point in the history
Enterprise
  • Loading branch information
erikaperugachi authored Aug 27, 2019
2 parents d7206b5 + 9e73115 commit 4469a0e
Show file tree
Hide file tree
Showing 34 changed files with 161 additions and 37 deletions.
5 changes: 3 additions & 2 deletions electron_app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "criptext",
"version": "0.23.3",
"version": "0.23.4",
"author": {
"name": "Criptext Inc",
"email": "support@criptext.com",
Expand Down Expand Up @@ -136,7 +136,7 @@
"@criptext/api": "^0.15.18",
"@criptext/data-transfer-client": "^0.1.1",
"@criptext/electron-better-ipc": "^0.1.2-rc5",
"@criptext/electron-push-receiver": "^2.1.2",
"@criptext/electron-push-receiver": "^2.1.2-rc1",
"@criptext/news-api-client": "^1.0.1",
"dotenv": "^6.2.0",
"electron-context-menu": "^0.10.1",
Expand All @@ -151,6 +151,7 @@
"os-locale": "^3.0.1",
"recursive-copy": "^2.0.10",
"rimraf": "^2.6.3",
"rmdir-recursive": "^0.0.1",
"sqlite3": "4.0.2",
"unused-filename": "^2.1.0",
"websocket": "^1.0.28"
Expand Down
2 changes: 1 addition & 1 deletion electron_app/src/BackupManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const createTempEmailsBackup = () => {
const EmailsFolder = getUserEmailsPath(process.env.NODE_ENV, getUsername());
return new Promise((resolve, reject) => {
try {
copy(EmailsFolder, TempEmailsBackupPath);
copy(EmailsFolder, TempEmailsBackupPath, { overwrite: true });
resolve();
} catch (error) {
reject({ error: 'Preparing backup error' });
Expand Down
8 changes: 6 additions & 2 deletions electron_app/src/dbExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ const exportLabelTable = async db => {
};

const exportEmailTable = async db => {
const username = `${myAccount.recipientId}@${APP_DOMAIN}`;
const username = myAccount.recipientId.includes('@')
? myAccount.recipientId
: `${myAccount.recipientId}@${APP_DOMAIN}`;
let emailRows = [];
let shouldEnd = false;
let offset = 0;
Expand Down Expand Up @@ -508,7 +510,9 @@ const importDatabaseFromFile = async ({ filepath, databasePath }) => {
};

const storeEmailBodies = emailRows => {
const username = `${myAccount.recipientId}@${APP_DOMAIN}`;
const username = myAccount.recipientId.includes('@')
? myAccount.recipientId
: `${myAccount.recipientId}@${APP_DOMAIN}`;
return Promise.all(
emailRows.map(email => {
const body = email.content;
Expand Down
6 changes: 5 additions & 1 deletion electron_app/src/ipc/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ ipc.answerRenderer(
);

ipc.answerRenderer('db-clean-database', async username => {
const user = username ? `${username}@${APP_DOMAIN}` : getUsername();
const user = username
? username.includes('@')
? username
: `${username}@${APP_DOMAIN}`
: getUsername();
if (user) {
await fileUtils.removeUserDir(user);
}
Expand Down
16 changes: 14 additions & 2 deletions electron_app/src/utils/FileUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const fs = require('fs');
const copy = require('recursive-copy');
const rmdirRecursive = require('rmdir-recursive');
const path = require('path');
const rimraf = require('rimraf');
const { app } = require('electron');
Expand All @@ -16,7 +18,8 @@ const getUserEmailsPath = (node_env, user) => {
const emailsPath = path
.join(__dirname, '/../userData', `${user}`, 'emails')
.replace('/src', '');
createPathRecursive(emailsPath);
const userToReplace = `${user}@${APP_DOMAIN}`;
createPathRecursive(emailsPath, userToReplace, user);
return emailsPath;
}
default: {
Expand Down Expand Up @@ -153,7 +156,16 @@ const createPathRecursive = (fullpath, oldUser, newUser) => {
const lastPath = path.resolve(parentDir, oldUser);
if (fs.existsSync(lastPath)) {
curDir = path.resolve(parentDir, newUser);
fs.renameSync(lastPath, curDir);
try {
fs.renameSync(lastPath, curDir);
} catch (err) {
const source = path.resolve(parentDir, `${oldUser}/emails/`);
const dest = path.resolve(parentDir, `${newUser}/emails/`);
copy(source, dest, { overwrite: true }).then(function() {
const folder = path.resolve(parentDir, `${oldUser}`);
rmdirRecursive(folder);
});
}
return curDir;
}
}
Expand Down
5 changes: 4 additions & 1 deletion electron_app/src/windows/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ const sendEventToMailbox = (eventName, data) => {
};

const saveDraftToDatabase = async (composerId, data) => {
const username = `${myAccount.recipientId}@${APP_DOMAIN}`;
const recipientId = myAccount.recipientId;
const username = recipientId.includes('@')
? recipientId
: `${recipientId}@${APP_DOMAIN}`;
const filteredRecipients = {
from: data.recipients.from,
to: filterInvalidEmailAddresses(data.recipients.to),
Expand Down
2 changes: 1 addition & 1 deletion electron_app/src/windows/mailbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const create = () => {
mailboxWindow.on('close', e => {
if (!globalManager.forcequit.get()) {
e.preventDefault();
if (mailboxWindow.isFullScreen()) {
if (mailboxWindow && mailboxWindow.isFullScreen()) {
mailboxWindow.setFullScreen(false);
setTimeout(() => hide(), 1200);
} else {
Expand Down
31 changes: 18 additions & 13 deletions electron_app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@
version "0.1.2-rc5"
resolved "https://registry.yarnpkg.com/@criptext/electron-better-ipc/-/electron-better-ipc-0.1.2-rc5.tgz#4a51755de1168b441fe6a68872fe8b95eaa742ab"

"@criptext/electron-push-receiver@^2.1.2":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@criptext/electron-push-receiver/-/electron-push-receiver-2.1.2.tgz#d971523d21bb473e9340f157af0c30760f7c417b"
integrity sha512-1QIx54AuC/XtdO37a7ExXF1yoKvyEnq7kXnsCGo1mTh9ER3hNqS9ox8hpBPRuA7TgkH2dQzDeAqsQS7IflsKMw==
"@criptext/electron-push-receiver@^2.1.2-rc1":
version "2.1.2-rc1"
resolved "https://registry.yarnpkg.com/@criptext/electron-push-receiver/-/electron-push-receiver-2.1.2-rc1.tgz#4c6be8acc7d5d17390a31872b52228866f757643"
integrity sha512-rYy1ZW5vQ6Z8QuMGMomXW7vKUXHbnsr4rMr7ee1aDjnNA3wzAMDWVTKiYmI3r9NFdnYTmIs2MwKCrQ4PQHy+rw==
dependencies:
electron-config "^1.0.0"
push-receiver "^2.0.2"
Expand Down Expand Up @@ -186,9 +186,9 @@
integrity sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==

"@types/node@^10.1.0":
version "10.14.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.4.tgz#1c586b991457cbb58fef51bc4e0cfcfa347714b5"
integrity sha512-DT25xX/YgyPKiHFOpNuANIQIVvYEwCWXgK2jYYwqgaMrYE6+tq+DtmMwlD3drl6DJbUwtlIDnn0d7tIn/EbXBg==
version "10.14.16"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.16.tgz#4d690c96cbb7b2728afea0e260d680501b3da5cf"
integrity sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA==

"@types/node@^8.0.24":
version "8.10.49"
Expand Down Expand Up @@ -3349,9 +3349,9 @@ lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"

lodash@^4.17.11:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==

long@^3.2.0:
version "3.2.0"
Expand Down Expand Up @@ -4591,6 +4591,11 @@ rimraf@^2.6.3:
dependencies:
glob "^7.1.3"

rmdir-recursive@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/rmdir-recursive/-/rmdir-recursive-0.0.1.tgz#57c0234af6e22ce642d0069cb2850f92966581b1"
integrity sha1-V8AjSvbiLOZC0AacsoUPkpZlgbE=

rsvp@^3.3.3:
version "3.6.2"
resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a"
Expand Down Expand Up @@ -5441,9 +5446,9 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.1.0:
signal-exit "^3.0.2"

write-file-atomic@^2.3.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.2.tgz#a7181706dfba17855d221140a9c06e15fcdd87b9"
integrity sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==
version "2.4.3"
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481"
integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==
dependencies:
graceful-fs "^4.1.11"
imurmurhash "^0.1.4"
Expand Down
2 changes: 1 addition & 1 deletion email_composer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "email_composer",
"version": "0.23.3",
"version": "0.23.4",
"private": true,
"dependencies": {
"@criptext/electron-better-ipc": "^0.1.2-rc5",
Expand Down
86 changes: 85 additions & 1 deletion email_composer/src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,90 @@ TABLE OF CONTENTS
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Thin.ttf) format("truetype");
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-ThinItalic.ttf) format("truetype");
font-weight: normal;
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Light.ttf) format("truetype");
font-weight: 200;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-LightItalic.ttf) format("truetype");
font-weight: 200;
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Regular.ttf) format("truetype");
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Italic.ttf) format("truetype");
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Medium.ttf) format("truetype");
font-weight: 600;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-MediumItalic.ttf) format("truetype");
font-weight: 600;
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Bold.ttf) format("truetype");
font-weight: 700;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-BoldItalic.ttf) format("truetype");
font-weight: 700;
font-style: italic;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-Black.ttf) format("truetype");
font-weight: 800;
font-style: normal;
}

@font-face {
font-family: "Roboto";
src:url(#{$_PATH_TO_FONTS}/roboto/Roboto-BlackItalic.ttf) format("truetype");
font-weight: 800;
font-style: italic;
}

/* 1.2.- FONTS: Icon
----------------------------- */
@font-face {
Expand Down Expand Up @@ -405,7 +489,7 @@ TABLE OF CONTENTS
/* 2.- CONTENT
----------------------------- */
*{
font-family: NunitoSans;
font-family: NunitoSans, Roboto;
}

html, html body {
Expand Down
2 changes: 1 addition & 1 deletion email_composer/src/components/TagRecipient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TagRecipient = props => {
const { name, email, complete, state, form } = getTagDisplayValue(tag);
const formattedTag =
!name && !email
? { name: tag, email: tag, complete: tag, form: tag }
? { name: tag, email: tag, complete: tag }
: { name, email, complete, state, form };

const isValidEmailAddress = emailRegex.test(formattedTag.email);
Expand Down
2 changes: 1 addition & 1 deletion email_composer/src/components/subject.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ div.subject-container{
background-color: transparent;
border: none;
color: black;
font-family: NunitoSans;
font-family: NunitoSans, Roboto;
font-size: 16px;
font-weight: 600;
margin-left: 20px;
Expand Down
5 changes: 3 additions & 2 deletions email_composer/src/containers/Composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ import string from './../lang';
import {
appDomain,
composerEvents,
defaultEmptyMimetypeValue
defaultEmptyMimetypeValue,
extensionsAccepted
} from '../utils/const';
import { generateKeyAndIv } from '../utils/AESUtils';
import { addEvent, removeEvent, Event } from '../utils/electronEventInterface';
Expand Down Expand Up @@ -385,7 +386,7 @@ class ComposerWrapper extends Component {
if (!item.type) {
const texts = item.name.split('.');
const ext = texts[texts.length - 1];
if (ext === 'xls') return true;
if (extensionsAccepted.includes(ext)) return true;
}
return !!item.type;
});
Expand Down
Binary file added email_composer/src/fonts/roboto/Roboto-Black.ttf
Binary file not shown.
Binary file not shown.
Binary file added email_composer/src/fonts/roboto/Roboto-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added email_composer/src/fonts/roboto/Roboto-Light.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added email_composer/src/fonts/roboto/Roboto-Thin.ttf
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion email_composer/src/utils/EmailUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const formDataToEditDraft = async emailKeyToEdit => {
iv: file.iv
};
});

return {
toEmails,
ccEmails,
Expand Down
7 changes: 7 additions & 0 deletions email_composer/src/utils/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export const composerEvents = {
};

export const defaultEmptyMimetypeValue = 'application/octet-stream';
export const extensionsAccepted = [
'xls',
'db',
'dmg',
'provisionprofile',
'iso'
];

export const previewLength = 100;

Expand Down
2 changes: 1 addition & 1 deletion email_loading/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "email_loading",
"version": "0.23.3",
"version": "0.23.4",
"private": true,
"dependencies": {
"@criptext/electron-better-ipc": "^0.1.2-rc5",
Expand Down
2 changes: 1 addition & 1 deletion email_login/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "email_login",
"version": "0.23.3",
"version": "0.23.4",
"private": true,
"dependencies": {
"@criptext/electron-better-ipc": "^0.1.2-rc5",
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "email_mailbox",
"version": "0.23.3",
"version": "0.23.4",
"private": true,
"dependencies": {
"@criptext/electron-better-ipc": "^0.1.2-rc5",
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/src/components/SettingBlockProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const renderBlockAvatar = props => (
type="file"
name="fileAvatar"
id="fileAvatar"
accept="image/*"
accept="image/x-png,image/jpeg"
onChange={props.onChangeAvatar}
/>
<label htmlFor={props.avatarIsLoading ? null : 'fileAvatar'}>
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/src/components/email.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
}

p{
font-family: 'NunitoSans';
font-family: NunitoSans, Roboto;
}

.cptx-div-collapse{
Expand Down
Loading

0 comments on commit 4469a0e

Please sign in to comment.