Skip to content

Commit ef2248e

Browse files
committed
fixes
1 parent e61da20 commit ef2248e

16 files changed

+188
-52
lines changed

src/components/popins/fullscreen/EnableWhitelist.vue

+20-6
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

+1-1
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

+6-2
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

+1
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

+1
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

+17
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

+1
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

+1-2
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

+7
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

+2
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();

src/services/SocketService.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ const socketHandler = (socket) => {
8686
if(request.data.passthrough)
8787
return socket.emit('paired', existingApp && existingApp.checkKey(request.data.appkey));
8888

89-
const addAuthorizedApp = (newKey = null) => {
89+
const addAuthorizedApp = async (newKey = null) => {
9090
const authedApp = new AuthorizedApp(request.data.origin, newKey ? newKey : request.data.appkey);
9191
const clone = scatter.clone();
9292
clone.keychain.updateOrPushApp(authedApp);
93-
store.dispatch(Actions.SET_SCATTER, clone);
93+
await store.dispatch(Actions.SET_SCATTER, clone);
9494
socket.emit('paired', true);
9595
};
9696

9797
const repair = async () => {
9898
const newKey = await getNewKey(socket);
9999
if(newKey.data.origin !== request.data.origin || newKey.data.appkey.indexOf('appkey:') === -1) return socket.emit('paired', false);
100-
addAuthorizedApp(newKey.data.appkey)
100+
return addAuthorizedApp(newKey.data.appkey)
101101
}
102102

103103
if(existingApp){

src/views/Home.vue

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
import SingletonService from "../services/SingletonService";
6565
import PopupService from "../services/PopupService";
6666
import {Popup} from "../models/popups/Popup";
67+
import Token from "../models/Token";
68+
import {Blockchains} from "../models/Blockchains";
69+
import TokenService from "../services/TokenService";
6770
6871
6972
export default {

src/views/Login.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
this.confirmPassword = '';
195195
196196
const lockout = getLockout();
197-
this.lockedOutTime = lockout.tried >= 5 ? lockout.stamp > 0 ? lockout.stamp + lockoutTime : 0 : 0;
197+
this.lockedOutTime = lockout.tried >= 10 ? lockout.stamp > 0 ? lockout.stamp + lockoutTime : 0 : 0;
198198
199199
document.addEventListener('keydown', this.modifyDPresses, true);
200200
},

src/views/PopOut.vue

+5-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
<template>
22
<section>
33

4-
<!--<section v-if="windowMessage">-->
5-
6-
<!--<get-identity v-if="popupType === apiActions.GET_OR_REQUEST_IDENTITY"-->
7-
<!--:payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></get-identity>-->
8-
9-
<!--<suggest-network v-if="popupType === apiActions.SUGGEST_NETWORK"-->
10-
<!--:payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></suggest-network>-->
11-
12-
<!--<signature-request v-if="popupType === apiActions.REQUEST_SIGNATURE || popupType === apiActions.REQUEST_ARBITRARY_SIGNATURE"-->
13-
<!--:payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></signature-request>-->
14-
15-
<!--<link-app v-if="popupType === 'linkApp'" :payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></link-app>-->
16-
17-
<!--<get-public-key v-if="popupType === apiActions.GET_PUBLIC_KEY" :payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></get-public-key>-->
18-
19-
<!--<link-account v-if="popupType === apiActions.LINK_ACCOUNT" :payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></link-account>-->
20-
21-
<!--<transfer-request v-if="popupType === apiActions.REQUEST_TRANSFER" :payload="payload" :plugin-origin="pluginOrigin" v-on:returned="returnResult"></transfer-request>-->
22-
23-
<!--</section>-->
24-
254
<section v-if="windowMessage" class="popout">
265

276
<AppLogin v-if="popupType === apiActions.GET_OR_REQUEST_IDENTITY"
@@ -35,15 +14,16 @@
3514
v-on:returned="returnResult" />
3615

3716
<GetPublicKey v-if="popupType === apiActions.GET_PUBLIC_KEY"
38-
:popup="popup"
39-
v-on:returned="returnResult" />
17+
:popup="popup" v-on:returned="returnResult" />
4018

4119
<TransferRequest v-if="popupType === apiActions.REQUEST_TRANSFER"
4220
:popup="popup" :pinning="pinning"
4321
v-on:returned="returnResult" />
4422

45-
<LinkApp :popup="popup" v-if="popupType === 'linkApp'" v-on:returned="returnResult" />
23+
<UpdateIdentity v-if="popupType === apiActions.UPDATE_IDENTITY"
24+
:popup="popup" v-on:returned="returnResult" />
4625

26+
<LinkApp :popup="popup" v-if="popupType === 'linkApp'" v-on:returned="returnResult" />
4727

4828
</section>
4929

@@ -76,6 +56,7 @@
7656
AppLogin:() => import('./popouts/AppLogin'),
7757
Signature:() => import('./popouts/Signature'),
7858
LinkApp:() => import('./popouts/LinkApp'),
59+
UpdateIdentity:() => import('./popouts/UpdateIdentity'),
7960
},
8061
mounted(){
8162
WindowService.watch('popup', windowMessage => {

src/views/popouts/Signature.vue

+17-13
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
<section :class="{'previous-whitelist':isPreviouslyWhitelisted(message)}">
8989

90-
<section class="details">
90+
<section class="details contract-action">
9191
<figure class="title">
9292
<input v-if="whitelisted && !isPreviouslyWhitelisted(message)"
9393
:checked="!!getWhitelist(message)"
@@ -432,18 +432,7 @@
432432
position: relative;
433433
434434
&:not(:first-child){
435-
padding:30px 0 20px;
436-
437-
&:after {
438-
content:'';
439-
position:absolute;
440-
top:0;
441-
left:-30px;
442-
right:-30px;
443-
height:2px;
444-
background:rgba(0,0,0,0.05);
445-
box-shadow:inset 0 1px 3px rgba(0,0,0,0.08), 0 1px 1px #fff;
446-
}
435+
margin-top:60px;
447436
}
448437
449438
.previous-whitelist {
@@ -546,5 +535,20 @@
546535
padding:0;
547536
}
548537
538+
.contract-action {
539+
margin:-20px -30px 0;
540+
border-top:1px solid rgba(0,0,0,0.04);
541+
padding:20px 30px;
542+
background:rgba(0,0,0,0.02);
543+
background:linear-gradient(-180deg, #f2f2f2 -10%, rgba(242, 242, 242, 0) 120%);
544+
box-shadow:0 2px 4px rgba(0,0,0,0.04), 0 8px 16px rgba(0,0,0,0.02);
545+
546+
.title {
547+
span {
548+
font-size: 18px;
549+
}
550+
}
551+
}
552+
549553
550554
</style>

0 commit comments

Comments
 (0)