1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Signature request fixes.

This commit is contained in:
Dan 2017-10-25 21:58:56 -02:30 committed by Chi Kei Chan
parent 39d4fe311f
commit ddf11011c9
4 changed files with 30 additions and 26 deletions

View File

@ -1,5 +1,5 @@
const extension = require('extensionizer') const extension = require('extensionizer')
const height = 520 const height = 610
const width = 360 const width = 360

View File

@ -156,20 +156,24 @@ SignatureRequest.prototype.msgHexToText = function (hex) {
SignatureRequest.prototype.renderBody = function () { SignatureRequest.prototype.renderBody = function () {
let rows let rows
let notice = 'You are signing:'
const { txData } = this.props const { txData } = this.props
const { type, msgParams: { data } } = txData const { type, msgParams: { data } } = txData
if (type === 'personal_sign') { if (type === 'personal_sign') {
rows = [{ name: 'Message:', value: this.msgHexToText(data) }] rows = [{ name: 'Message', value: this.msgHexToText(data) }]
} }
else if (type === 'eth_signTypedData') { else if (type === 'eth_signTypedData') {
rows = data rows = data
} }
// given the warning in './pending-msg.js', eth_sign' has not been implemented on NewUI-flat at this time else if (type === 'eth_sign') {
// else if (type === 'eth_sign') { rows = [{ name: 'Message', value: data }]
// console.log('Not currently supported') notice = `Signing this message can have
// } dangerous side effects. Only sign messages from
sites you fully trust with your entire account.
This dangerous method will be removed in a future version. `
}
return h('div.request-signature__body', {}, [ return h('div.request-signature__body', {}, [
@ -177,7 +181,7 @@ SignatureRequest.prototype.renderBody = function () {
this.renderRequestInfo(), this.renderRequestInfo(),
h('div.request-signature__notice', ['You are signing:']), h('div.request-signature__notice', [notice]),
h('div.request-signature__rows', [ h('div.request-signature__rows', [
@ -200,6 +204,8 @@ SignatureRequest.prototype.renderFooter = function () {
signTypedMessage, signTypedMessage,
cancelPersonalMessage, cancelPersonalMessage,
cancelTypedMessage, cancelTypedMessage,
signMessage,
cancelMessage,
} = this.props } = this.props
const { txData } = this.props const { txData } = this.props
@ -215,6 +221,10 @@ SignatureRequest.prototype.renderFooter = function () {
cancel = cancelTypedMessage cancel = cancelTypedMessage
sign = signTypedMessage sign = signTypedMessage
} }
else if (type === 'eth_sign') {
cancel = cancelMessage
sign = signMessage
}
return h('div.request-signature__footer', [ return h('div.request-signature__footer', [
h('div.request-signature__footer__cancel-button', { h('div.request-signature__footer__cancel-button', {

View File

@ -121,7 +121,7 @@ function currentTxView (opts) {
return h(PendingTx, opts) return h(PendingTx, opts)
} else if (msgParams) { } else if (msgParams) {
log.debug('msgParams detected, rendering pending msg') log.debug('msgParams detected, rendering pending msg')
return h(SignatureRequest, opts) return h(SignatureRequest, opts)
// if (type === 'eth_sign') { // if (type === 'eth_sign') {

View File

@ -1,6 +1,5 @@
.request-signature { .request-signature {
&__container { &__container {
height: 619px;
width: 380px; width: 380px;
border-radius: 8px; border-radius: 8px;
background-color: $white; background-color: $white;
@ -11,6 +10,7 @@
align-items: center; align-items: center;
font-family: Roboto; font-family: Roboto;
position: relative; position: relative;
height: 100%;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
width: 100%; width: 100%;
@ -68,7 +68,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 18px; margin-top: 18px;
height: 69px; margin-bottom: 20px;
} }
&__account { &__account {
@ -97,11 +97,14 @@
} }
&__request-icon { &__request-icon {
align-self: flex-end; margin-top: 25px;
} }
&__body { &__body {
width: 100%; width: 100%;
height: 100%;
display: flex;
flex-flow: column;
} }
&__request-info { &__request-info {
@ -122,42 +125,33 @@
} }
&__notice { &__notice {
height: 19px;
width: 105px;
color: #9B9B9B; color: #9B9B9B;
font-family: "Avenir Next"; font-family: "Avenir Next";
font-size: 14px; font-size: 14px;
line-height: 19px; line-height: 19px;
text-align: center; text-align: center;
margin-top: 21px; margin-top: 41px;
margin-bottom: 11px; margin-bottom: 11px;
width: 100%; width: 100%;
} }
&__rows { &__rows {
height: 262px; height: 100%;
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
border-top: 1px solid $geyser; border-top: 1px solid $geyser;
display: flex;
@media screen and (max-width: $break-small) { flex-flow: column;
height: 208px; padding-right: 4px;
}
} }
// &__rows::-webkit-scrollbar {
// display: none;
// }
&__row { &__row {
height: 74px;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
border-bottom: 1px solid $geyser; border-bottom: 1px solid $geyser;
} }
&__row-title { &__row-title {
height: 22px;
width: 80px; width: 80px;
color: $dusty-gray; color: $dusty-gray;
font-family: Roboto; font-family: Roboto;
@ -169,7 +163,6 @@
} }
&__row-value { &__row-value {
height: 19px;
color: $scorpion; color: $scorpion;
font-family: Roboto; font-family: Roboto;
font-size: 14px; font-size: 14px;
@ -178,6 +171,7 @@
margin-bottom: 15px; margin-bottom: 15px;
margin-left: 18px; margin-left: 18px;
width: 95%; width: 95%;
overflow-wrap: break-word;
} }
&__footer { &__footer {