Skip to content

Commit ef2248e

Browse files
committed
fixes
1 parent e61da20 commit ef2248e

File tree

16 files changed

+188
-52
lines changed

16 files changed

+188
-52
lines changed

src/components/popins/fullscreen/EnableWhitelist.vue

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<section>
3-
<section class="full-panel inner center-fold limited">
3+
<section class="full-panel inner center-fold limited whitelist">
44
<section>
55
<section class="head">
6-
<figure class="title">{{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.Title)}}</figure>
6+
<!--<figure class="title">{{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.Title)}}</figure>-->
77
<p>
88
{{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.Desc)}}
99
</p>
@@ -19,15 +19,15 @@
1919
<br>
2020

2121
<section class="mock-props">
22-
<label>Amount <b class="red">( {{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.MutableProp)}} )</b></label>
22+
<label>amount <b class="red">({{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.MutableProp)}})</b></label>
2323
<section class="split-inputs">
2424
<input checked disabled="true" type="checkbox" />
2525
<figure class="value">1 TOKENS</figure>
2626
</section>
2727
</section>
2828

2929
<section class="mock-props">
30-
<label>Recipient <b class="red">( {{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.ImmutableProp)}} )</b></label>
30+
<label>recipient <b class="red">({{locale(langKeys.POPINS.FULLSCREEN.WHITELISTING.ImmutableProp)}})</b></label>
3131
<section class="split-inputs">
3232
<input disabled="true" type="checkbox" />
3333
<figure class="value">xxxxxxxxxxxxx</figure>
@@ -39,8 +39,8 @@
3939
</section>
4040

4141
<section class="action-bar short bottom centered">
42-
<btn :text="locale(langKeys.GENERIC.Deny)" red="1" v-on:clicked="returnResult(false)" />
43-
<btn :text="locale(langKeys.GENERIC.Confirm)" blue="1" v-on:clicked="returnResult(true)" />
42+
<btn :text="locale(langKeys.GENERIC.Back)" v-on:clicked="returnResult(false)" />
43+
<btn :text="locale(langKeys.GENERIC.Enable)" blue="1" v-on:clicked="returnResult(true)" />
4444
</section>
4545
</section>
4646
</section>
@@ -94,6 +94,8 @@
9494
border:1px solid rgba(0,0,0,0.1);
9595
border-radius:4px;
9696
margin-bottom:5px;
97+
background:#fff;
98+
color:$dark-grey;
9799
98100
input {
99101
width:20px;
@@ -108,6 +110,18 @@
108110
}
109111
}
110112
113+
.whitelist {
114+
background:$reverse-gradient;
115+
color:#fff;
116+
}
117+
118+
.head {
119+
p {
120+
color:rgba(255,255,255,0.65);
121+
font-size: 13px;
122+
}
123+
}
124+
111125
.action-bar {
112126
button {
113127
width:auto;

src/components/popins/fullscreen/Exchange.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@
475475
476476
if(sent){
477477
if(!TokenService.hasToken(this.pair.token)){
478-
if(this.pair.token.contract && !this.pair.token.contract.length) {
478+
if(!!this.pair.token.contract && !!this.pair.token.contract.length) {
479479
await TokenService.addToken(this.pair.token, false, false);
480480
}
481481
}

src/migrations/versions/9.0.0.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import {Blockchains} from '../../models/Blockchains'
33
import {store} from '../../store/store'
44
import Crypto from '../../util/Crypto';
55
import {BlockchainsArray} from '../../models/Blockchains';
6+
import {ipcAsync} from "../../util/ElectronHelpers";
67

78
export const m9_0_0 = async scatter => {
9+
const seed = await ipcAsync('seed');
810

911
scatter.keychain.keypairs.map(x => {
1012
if(x.hasOwnProperty('publicKeys') && x.publicKeys.length) return false;
1113

12-
x.decrypt(store.state.seed);
14+
15+
16+
x.decrypt(seed);
1317

1418
if(!x.external) {
1519
x.privateKey = Crypto.privateKeyToBuffer(x.privateKey, x.blockchain);
@@ -31,7 +35,7 @@ export const m9_0_0 = async scatter => {
3135
}
3236
});
3337

34-
x.encrypt(store.state.seed);
38+
x.encrypt(seed);
3539
});
3640

3741
// Wiping out permissions

src/models/api/ApiActions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ export const CREATE_TRANSACTION = 'createTransaction';
1212
export const REQUEST_ARBITRARY_SIGNATURE = 'requestArbitrarySignature';
1313
export const SUGGEST_NETWORK = 'requestAddNetwork';
1414
export const AUTHENTICATE = 'authenticate';
15+
export const UPDATE_IDENTITY = 'updateIdentity';

src/models/popups/Popup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class Popup {
2929
case ApiActions.GET_OR_REQUEST_IDENTITY:
3030
case ApiActions.REQUEST_TRANSFER:
3131
case ApiActions.GET_PUBLIC_KEY:
32+
case ApiActions.UPDATE_IDENTITY:
3233
return {width:420, height:600};
3334
case ApiActions.REQUEST_SIGNATURE:
3435
return {width:920, height:600};

src/services/ApiService.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,23 @@ export default class ApiService {
377377
})
378378
}
379379

380+
static async [Actions.UPDATE_IDENTITY](request){
381+
return new Promise(async resolve => {
382+
383+
const {origin, name, kyc} = request.payload;
384+
385+
386+
const possibleId = PermissionService.identityFromPermissions(origin, false);
387+
if(!possibleId) return resolve({id:request.id, result:Error.identityMissing()});
388+
389+
PopupService.push(Popup.popout(Object.assign(request, {}), async ({result}) => {
390+
if(!result || (!result.accepted || false)) return resolve({id:request.id, result:Error.signatureError("signature_rejected", "User rejected the signature request")});
391+
392+
resolve({id:request.id, result:possibleId});
393+
}));
394+
});
395+
}
396+
380397

381398

382399

src/services/ExchangeService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class ExchangeService {
2121

2222
static async pairs(token){
2323
return timeout(POST('exchange/pairs', {token})).then(pairs => {
24+
if(!pairs) return [];
2425
Object.keys(pairs).map(key => pairs[key].map(x => x.token = Token.fromJson(x.token)));
2526
return pairs;
2627
});

src/services/PasswordService.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default class PasswordService {
8787

8888
// Setting a new salt every time the password is changed.
8989
await StorageService.setSalt(Hasher.unsaltedQuickHash(IdGenerator.text(32)));
90-
const [newMnemonic, newSeed] = await Mnemonic.generateMnemonic(newPassword);
90+
const [newMnemonic, newSeed] = await this.seedPassword(newPassword, true);
9191

9292
// Re-encrypting keypairs
9393
const scatter = store.state.scatter.clone();
@@ -100,7 +100,6 @@ export default class PasswordService {
100100
id.encrypt(newSeed);
101101
});
102102

103-
await store.commit(Actions.SET_SEED, newSeed);
104103
await store.dispatch(Actions.SET_SCATTER, scatter);
105104
await StorageService.swapHistory(store.state.history);
106105
await StorageService.setTranslation(store.getters.language);

src/services/PermissionService.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,11 @@ export default class PermissionService {
201201
})
202202
}
203203

204+
static async removeDanglingPermissions(){
205+
const scatter = store.state.scatter.clone();
206+
const origins = scatter.keychain.permissions.map(x => x.origin);
207+
scatter.keychain.apps = scatter.keychain.apps.filter(x => origins.includes(x.origin));
208+
return store.dispatch(Actions.SET_SCATTER, scatter);
209+
}
210+
204211
}

src/services/SingletonService.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import AccountService from "./AccountService";
44
import LanguageService from "./LanguageService";
55
import PriceService from "./PriceService";
66
import RecurringService from "./RecurringService";
7+
import PermissionService from "./PermissionService";
78

89
let initialized = false;
910

@@ -14,6 +15,7 @@ export default class SingletonService {
1415
initialized = true;
1516
store.dispatch(Actions.LOAD_HISTORY);
1617
store.dispatch(Actions.LOAD_LANGUAGE);
18+
await PermissionService.removeDanglingPermissions();
1719
await AccountService.fixOrphanedAccounts();
1820
await LanguageService.regenerateLanguage();
1921
await PriceService.watchPrices();

0 commit comments

Comments
 (0)