@@ -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' ;
1620import string from '../lang' ;
1721
18- import { myAccount } from '../utils/electronInterface' ;
22+ import { myAccount , mySettings , isFromStore } from '../utils/electronInterface' ;
1923
2024const { errors } = string . newSignUp . create ;
2125const 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+ } ;
0 commit comments