Skip to content

Commit b87d024

Browse files
authored
Merge pull request #1523 from Hirobreak/launcher
fixing launch screen when signup process has not finish
2 parents 6827426 + 5382741 commit b87d024

File tree

10 files changed

+58
-15
lines changed

10 files changed

+58
-15
lines changed

electron_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "criptext",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"author": {
55
"name": "Criptext Inc",
66
"email": "[email protected]",

electron_app/src/windows/index.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@ const upStepCreateDBEncrypted = async () => {
3434
/* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
3535
const upStepCheckPIN = async () => {
3636
try {
37-
const fallback = await dbManager.rawCheckPin(DEFAULT_PIN);
38-
if (fallback) {
39-
if (fallback.length) {
40-
myAccount.initialize(fallback);
41-
globalManager.pinData.set({ pinType: 'signin' });
42-
pinWindow.show();
43-
} else {
37+
const existingAccounts = await dbManager.rawCheckPin(DEFAULT_PIN);
38+
if (existingAccounts) {
39+
if (
40+
!existingAccounts.length ||
41+
(existingAccounts.length === 1 &&
42+
!existingAccounts[0].jwt &&
43+
!existingAccounts[0].refreshToken)
44+
) {
4445
await deleteEncryptedDatabase();
4546
upStepNewUser();
47+
} else {
48+
myAccount.initialize(existingAccounts[0]);
49+
globalManager.pinData.set({ pinType: 'signin' });
50+
pinWindow.show();
4651
}
4752
return;
4853
}

email_composer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_composer",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_loading/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_loading",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_login/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_login",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_login/src/signal/signup.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ import {
88
getAccountByParams,
99
cleanDatabase,
1010
getComputerName,
11+
getSettings,
12+
getSystemLanguage,
13+
createSettings,
1114
updateAccount,
1215
getContactByEmails,
1316
createContact,
1417
logLocal
1518
} from '../utils/ipc';
19+
import { hashPassword } from '../utils/HashUtils';
1620
import string from '../lang';
1721

18-
import { myAccount } from '../utils/electronInterface';
22+
import { myAccount, mySettings, isFromStore } from '../utils/electronInterface';
1923

2024
const { errors } = string.newSignUp.create;
2125
const recoveryErrors = string.newSignUp.recovery.recovery.errors;
@@ -117,7 +121,7 @@ const postKeyBundle = async ({
117121
}) => {
118122
const res = await postUser({
119123
recipientId,
120-
password,
124+
password: hashPassword(password),
121125
name,
122126
recoveryEmail,
123127
keybundle,
@@ -190,6 +194,7 @@ const prepareAccount = async ({
190194
}
191195

192196
await createOwnContact(name, myAccount.email, myAccount.id);
197+
await setDefaultSettings();
193198
return {
194199
recipientId,
195200
accountId: newAccount.id
@@ -207,3 +212,21 @@ const createOwnContact = async (name, email) => {
207212
logLocal(createContactDbError.stack);
208213
}
209214
};
215+
216+
const setDefaultSettings = async () => {
217+
const settings = await getSettings();
218+
if (settings) {
219+
mySettings.initialize({
220+
...settings,
221+
isFromStore: isFromStore
222+
});
223+
} else {
224+
const language = await getSystemLanguage();
225+
const data = { language, opened: false, theme: 'light' };
226+
await createSettings(data);
227+
mySettings.initialize({
228+
...data,
229+
isFromStore: isFromStore
230+
});
231+
}
232+
};

email_login/src/utils/electronInterface.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,6 @@ export const showOpenFileDialog = () => {
9090
export const setLoginInformation = params => {
9191
return globalManager.loginData.set(params);
9292
};
93+
94+
export const isFromStore =
95+
globalManager.isWindowsStore.get() || globalManager.isMAS.get();

email_login/src/utils/ipc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export const getDefaultBackupFolder = async () => {
4848
return await ipc.callMain('get-default-backup-folder');
4949
};
5050

51+
export const getSystemLanguage = async () => {
52+
return await ipc.callMain('get-system-language');
53+
};
54+
5155
export const swapMailboxAccount = params => {
5256
ipc.callMain('swap-account', params);
5357
};
@@ -76,6 +80,10 @@ export const createContact = async params => {
7680
return await ipc.callMain('db-create-contact', params);
7781
};
7882

83+
export const createSettings = async params => {
84+
return await ipc.callMain('db-create-settings', params);
85+
};
86+
7987
export const getAccountByParams = async params => {
8088
return await ipc.callMain('db-get-account-by-params', params);
8189
};
@@ -88,6 +96,10 @@ export const updateAccount = async params => {
8896
return await ipc.callMain('db-update-account', params);
8997
};
9098

99+
export const getSettings = async () => {
100+
return await ipc.callMain('db-get-settings');
101+
};
102+
91103
export const updateSettings = async params => {
92104
return await ipc.callMain('db-update-settings', params);
93105
};

email_mailbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_mailbox",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_pin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_pin",
3-
"version": "0.30.4",
3+
"version": "0.31.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

0 commit comments

Comments
 (0)