mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-03-27 15:55:55 +00:00
Rename to Qora and recheck password on create account
This commit is contained in:
parent
5584398067
commit
bb98fc87eb
@ -2,8 +2,6 @@ import { LitElement, html, css } from 'lit-element'
|
|||||||
import { connect } from 'pwa-helpers'
|
import { connect } from 'pwa-helpers'
|
||||||
import { store } from '../../store.js'
|
import { store } from '../../store.js'
|
||||||
|
|
||||||
// import { send } from '../../__src.js'
|
|
||||||
|
|
||||||
import { createWallet } from '../../../../qortal-ui-crypto/api/createWallet.js'
|
import { createWallet } from '../../../../qortal-ui-crypto/api/createWallet.js'
|
||||||
|
|
||||||
import FileSaver from 'file-saver'
|
import FileSaver from 'file-saver'
|
||||||
@ -38,7 +36,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
backDisabled: { type: Boolean, notify: true },
|
backDisabled: { type: Boolean, notify: true },
|
||||||
backText: { type: String, notify: true },
|
backText: { type: String, notify: true },
|
||||||
hideNav: { type: Boolean, notify: true },
|
hideNav: { type: Boolean, notify: true },
|
||||||
|
|
||||||
selectedPage: { type: String },
|
selectedPage: { type: String },
|
||||||
error: { type: Boolean },
|
error: { type: Boolean },
|
||||||
errorMessage: { type: String },
|
errorMessage: { type: String },
|
||||||
@ -97,6 +94,7 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
this.createAccountLoading = true
|
this.createAccountLoading = true
|
||||||
const nameInput = this.shadowRoot.getElementById('nameInput').value
|
const nameInput = this.shadowRoot.getElementById('nameInput').value
|
||||||
const password = this.shadowRoot.getElementById('password').value
|
const password = this.shadowRoot.getElementById('password').value
|
||||||
|
const rePassword = this.shadowRoot.getElementById('rePassword').value
|
||||||
|
|
||||||
if (password === '') {
|
if (password === '') {
|
||||||
snackbar.add({
|
snackbar.add({
|
||||||
@ -106,6 +104,14 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (password != rePassword) {
|
||||||
|
snackbar.add({
|
||||||
|
labelText: 'Passwords not match!',
|
||||||
|
dismiss: true
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (password.length < 8 && lastPassword !== password) {
|
if (password.length < 8 && lastPassword !== password) {
|
||||||
snackbar.add({
|
snackbar.add({
|
||||||
labelText: 'Your password is less than 8 characters! This is not recommended. You can continue to ignore this warning.',
|
labelText: 'Your password is less than 8 characters! This is not recommended. You can continue to ignore this warning.',
|
||||||
@ -237,43 +243,47 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
div[hidden] {
|
div[hidden] {
|
||||||
display:none !important;
|
display:none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex {
|
.flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex.column {
|
.flex.column {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
#createAccountSection {
|
#createAccountSection {
|
||||||
max-height: calc(var(--window-height) - 56px);
|
max-height: calc(var(--window-height) - 56px);
|
||||||
max-width: 440px;
|
max-width: 440px;
|
||||||
/* max-height: 500px; */
|
|
||||||
max-height:calc(100% - 100px);
|
max-height:calc(100% - 100px);
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
overflow-y:auto;
|
overflow-y:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#createAccountPages {
|
#createAccountPages {
|
||||||
flex-shrink:1;
|
flex-shrink:1;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
/* overflow:auto; */
|
|
||||||
left:0;
|
left:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#createAccountPages [page] {
|
#createAccountPages [page] {
|
||||||
flex-shrink:1;
|
flex-shrink:1;
|
||||||
}
|
}
|
||||||
/* .section-content {
|
|
||||||
|
.section-content {
|
||||||
padding:0 24px;
|
padding:0 24px;
|
||||||
padding-bottom:0;
|
padding-bottom:0;
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
flex-shrink:1;
|
flex-shrink:1;
|
||||||
max-height: calc(100vh - 296px);
|
max-height: calc(100vh - 296px);
|
||||||
|
}
|
||||||
} */
|
|
||||||
|
|
||||||
#download-area {
|
#download-area {
|
||||||
border: 2px dashed #ccc;
|
border: 2px dashed #ccc;
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#trigger:hover {
|
#trigger:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -281,6 +291,7 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::before {
|
mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::before {
|
||||||
background-color:var(--mdc-theme-primary)
|
background-color:var(--mdc-theme-primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: ${getComputedStyle(document.body).getPropertyValue('--layout-breakpoint-tablet')}) {
|
@media only screen and (max-width: ${getComputedStyle(document.body).getPropertyValue('--layout-breakpoint-tablet')}) {
|
||||||
/* Mobile */
|
/* Mobile */
|
||||||
#createAccountSection {
|
#createAccountSection {
|
||||||
@ -300,16 +311,16 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
#infoContent p {
|
#infoContent p {
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fade {
|
@keyframes fade {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
/* transform: translateX(-20%) */
|
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
/* transform: translateX(0) */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iron-pages .animated {
|
iron-pages .animated {
|
||||||
animation-duration: 0.6s;
|
animation-duration: 0.6s;
|
||||||
animation-name: fade;
|
animation-name: fade;
|
||||||
@ -390,6 +401,10 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
<mwc-icon style="padding: 20px; padding-left:0; padding-top: 28px;">vpn_key</mwc-icon>
|
<mwc-icon style="padding: 20px; padding-left:0; padding-top: 28px;">vpn_key</mwc-icon>
|
||||||
<paper-input style="width:100%;" label="Password" id="password" type="password"></paper-input>
|
<paper-input style="width:100%;" label="Password" id="password" type="password"></paper-input>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="display:flex;">
|
||||||
|
<mwc-icon style="padding: 20px; padding-left:0; padding-top: 28px;">vpn_key</mwc-icon>
|
||||||
|
<paper-input style="width:100%;" label="Confirm Password" id="rePassword" type="password"></paper-input>
|
||||||
|
</div>
|
||||||
<div style="text-align:right; vertical-align: top; line-height: 40px; margin:0;">
|
<div style="text-align:right; vertical-align: top; line-height: 40px; margin:0;">
|
||||||
<label
|
<label
|
||||||
for="saveInBrowserCheckbox"
|
for="saveInBrowserCheckbox"
|
||||||
@ -495,7 +510,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
|
|
||||||
stateChanged(state) {
|
stateChanged(state) {
|
||||||
this.nodeConfig = state.app.nodeConfig
|
this.nodeConfig = state.app.nodeConfig
|
||||||
// this.loggedIn = state.app.loggedIn
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createAccount() {
|
createAccount() {
|
||||||
@ -506,7 +520,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
|
|||||||
const state = store.getState()
|
const state = store.getState()
|
||||||
const data = await wallet.generateSaveWalletData(this._pass, state.config.crypto.kdfThreads, () => { })
|
const data = await wallet.generateSaveWalletData(this._pass, state.config.crypto.kdfThreads, () => { })
|
||||||
const dataString = JSON.stringify(data)
|
const dataString = JSON.stringify(data)
|
||||||
|
|
||||||
const blob = new Blob([dataString], { type: 'text/plain;charset=utf-8' })
|
const blob = new Blob([dataString], { type: 'text/plain;charset=utf-8' })
|
||||||
FileSaver.saveAs(blob, `qortal_backup_${wallet.addresses[0].address}.json`)
|
FileSaver.saveAs(blob, `qortal_backup_${wallet.addresses[0].address}.json`)
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
backDisabled: { type: Boolean, notify: true },
|
backDisabled: { type: Boolean, notify: true },
|
||||||
backText: { type: String, notify: true },
|
backText: { type: String, notify: true },
|
||||||
hideNav: { type: Boolean, notify: true },
|
hideNav: { type: Boolean, notify: true },
|
||||||
|
|
||||||
loginFunction: { type: Object },
|
loginFunction: { type: Object },
|
||||||
selectedWallet: { type: Object },
|
selectedWallet: { type: Object },
|
||||||
selectedPage: { type: String },
|
selectedPage: { type: String },
|
||||||
@ -63,7 +62,6 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
super()
|
super()
|
||||||
this.nextHidden = true
|
this.nextHidden = true
|
||||||
this.backText = 'Back'
|
this.backText = 'Back'
|
||||||
|
|
||||||
this.backedUpSeedLoading = false
|
this.backedUpSeedLoading = false
|
||||||
this.hasStoredWallets = Object.keys(store.getState().user.storedWallets).length > 0
|
this.hasStoredWallets = Object.keys(store.getState().user.storedWallets).length > 0
|
||||||
this.selectedPage = this.hasStoredWallets ? 'storedWallet' : 'loginOptions'
|
this.selectedPage = this.hasStoredWallets ? 'storedWallet' : 'loginOptions'
|
||||||
@ -84,7 +82,7 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
page: 'seed',
|
page: 'seed',
|
||||||
linkText: 'Qortal address seed',
|
linkText: 'Qora address seed',
|
||||||
icon: 'clear_all'
|
icon: 'clear_all'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -282,7 +280,7 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
<div page="seed" id="seedPage">
|
<div page="seed" id="seedPage">
|
||||||
<div>
|
<div>
|
||||||
<div style="display:flex;">
|
<div style="display:flex;">
|
||||||
<mwc-textfield style="width:100%;" icon="clear_all" label="Qortal address seed" id="v1SeedInput" type="password"></mwc-textfield>
|
<mwc-textfield style="width:100%;" icon="clear_all" label="Qora address seed" id="v1SeedInput" type="password"></mwc-textfield>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -362,10 +360,10 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
this.selectedPage = 'unlockStored'
|
this.selectedPage = 'unlockStored'
|
||||||
}
|
}
|
||||||
|
|
||||||
removeWallet(walletAddress){
|
removeWallet(walletAddress) {
|
||||||
if(window.confirm('Are you sure you want to remove this wallet from saved wallets?')) {
|
if (window.confirm('Are you sure you want to remove this wallet from saved wallets?')) {
|
||||||
delete store.getState().user.storedWallets[walletAddress]
|
delete store.getState().user.storedWallets[walletAddress]
|
||||||
this.wallets=store.getState().user.storedWallets
|
this.wallets = store.getState().user.storedWallets
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
doRemoveWallet(walletAddress)
|
doRemoveWallet(walletAddress)
|
||||||
)//.catch(err => console.error(err))
|
)//.catch(err => console.error(err))
|
||||||
@ -439,15 +437,15 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showPassword(selectedPage) {
|
showPassword(selectedPage) {
|
||||||
let willBeShown= (
|
let willBeShown = (
|
||||||
this.saveInBrowser && [
|
this.saveInBrowser && [
|
||||||
'unlockBackedUpSeed',
|
'unlockBackedUpSeed',
|
||||||
'seed',
|
'seed',
|
||||||
'phrase'
|
'phrase'
|
||||||
].includes(selectedPage)
|
].includes(selectedPage)
|
||||||
) || (['unlockBackedUpSeed','unlockStored'].includes(selectedPage))
|
) || (['unlockBackedUpSeed', 'unlockStored'].includes(selectedPage))
|
||||||
|
|
||||||
if(willBeShown)//if the password will be displayed lt's give it focus
|
if (willBeShown)//if the password will be displayed lt's give it focus
|
||||||
this.shadowRoot.getElementById('password').focus()
|
this.shadowRoot.getElementById('password').focus()
|
||||||
|
|
||||||
return willBeShown
|
return willBeShown
|
||||||
@ -475,10 +473,10 @@ class LoginSection extends connect(store)(LitElement) {
|
|||||||
},
|
},
|
||||||
phrase: () => {
|
phrase: () => {
|
||||||
const seedPhrase = this.shadowRoot.querySelector('#existingSeedPhraseInput').value
|
const seedPhrase = this.shadowRoot.querySelector('#existingSeedPhraseInput').value
|
||||||
if (seedPhrase == "") {
|
if (seedPhrase == "") {
|
||||||
throw new Error('Please enter a seedphrase')
|
throw new Error('Please enter a seedphrase')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const name = this.shadowRoot.getElementById('nameInput').value
|
const name = this.shadowRoot.getElementById('nameInput').value
|
||||||
const password = this.shadowRoot.getElementById('password').value
|
const password = this.shadowRoot.getElementById('password').value
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user