4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Rename to Qora and recheck password on create account

This commit is contained in:
AlphaX-Projects 2022-01-26 06:36:24 -08:00 committed by GitHub
parent 5584398067
commit bb98fc87eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 26 deletions

View File

@ -2,8 +2,6 @@ import { LitElement, html, css } from 'lit-element'
import { connect } from 'pwa-helpers'
import { store } from '../../store.js'
// import { send } from '../../__src.js'
import { createWallet } from '../../../../qortal-ui-crypto/api/createWallet.js'
import FileSaver from 'file-saver'
@ -38,7 +36,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
backDisabled: { type: Boolean, notify: true },
backText: { type: String, notify: true },
hideNav: { type: Boolean, notify: true },
selectedPage: { type: String },
error: { type: Boolean },
errorMessage: { type: String },
@ -97,6 +94,7 @@ class CreateAccountSection extends connect(store)(LitElement) {
this.createAccountLoading = true
const nameInput = this.shadowRoot.getElementById('nameInput').value
const password = this.shadowRoot.getElementById('password').value
const rePassword = this.shadowRoot.getElementById('rePassword').value
if (password === '') {
snackbar.add({
@ -106,6 +104,14 @@ class CreateAccountSection extends connect(store)(LitElement) {
return
}
if (password != rePassword) {
snackbar.add({
labelText: 'Passwords not match!',
dismiss: true
})
return
}
if (password.length < 8 && lastPassword !== password) {
snackbar.add({
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] {
display:none !important;
}
.flex {
display: flex;
}
.flex.column {
flex-direction: column;
}
#createAccountSection {
max-height: calc(var(--window-height) - 56px);
max-width: 440px;
/* max-height: 500px; */
max-height:calc(100% - 100px);
padding: 0 12px;
overflow-y:auto;
}
#createAccountPages {
flex-shrink:1;
text-align: left;
/* overflow:auto; */
left:0;
}
#createAccountPages [page] {
flex-shrink:1;
}
/* .section-content {
.section-content {
padding:0 24px;
padding-bottom:0;
overflow:auto;
flex-shrink:1;
max-height: calc(100vh - 296px);
} */
}
#download-area {
border: 2px dashed #ccc;
font-family: "Roboto", sans-serif;
padding: 10px;
}
#trigger:hover {
cursor: pointer;
}
@ -281,6 +291,7 @@ class CreateAccountSection extends connect(store)(LitElement) {
mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::before {
background-color:var(--mdc-theme-primary)
}
@media only screen and (max-width: ${getComputedStyle(document.body).getPropertyValue('--layout-breakpoint-tablet')}) {
/* Mobile */
#createAccountSection {
@ -300,16 +311,16 @@ class CreateAccountSection extends connect(store)(LitElement) {
#infoContent p {
text-align: justify;
}
@keyframes fade {
from {
opacity: 0;
/* transform: translateX(-20%) */
}
to {
opacity: 1;
/* transform: translateX(0) */
}
}
iron-pages .animated {
animation-duration: 0.6s;
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>
<paper-input style="width:100%;" label="Password" id="password" type="password"></paper-input>
</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;">
<label
for="saveInBrowserCheckbox"
@ -495,7 +510,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
stateChanged(state) {
this.nodeConfig = state.app.nodeConfig
// this.loggedIn = state.app.loggedIn
}
createAccount() {
@ -506,7 +520,6 @@ class CreateAccountSection extends connect(store)(LitElement) {
const state = store.getState()
const data = await wallet.generateSaveWalletData(this._pass, state.config.crypto.kdfThreads, () => { })
const dataString = JSON.stringify(data)
const blob = new Blob([dataString], { type: 'text/plain;charset=utf-8' })
FileSaver.saveAs(blob, `qortal_backup_${wallet.addresses[0].address}.json`)
}

View File

@ -37,7 +37,6 @@ class LoginSection extends connect(store)(LitElement) {
backDisabled: { type: Boolean, notify: true },
backText: { type: String, notify: true },
hideNav: { type: Boolean, notify: true },
loginFunction: { type: Object },
selectedWallet: { type: Object },
selectedPage: { type: String },
@ -63,7 +62,6 @@ class LoginSection extends connect(store)(LitElement) {
super()
this.nextHidden = true
this.backText = 'Back'
this.backedUpSeedLoading = false
this.hasStoredWallets = Object.keys(store.getState().user.storedWallets).length > 0
this.selectedPage = this.hasStoredWallets ? 'storedWallet' : 'loginOptions'
@ -84,7 +82,7 @@ class LoginSection extends connect(store)(LitElement) {
},
{
page: 'seed',
linkText: 'Qortal address seed',
linkText: 'Qora address seed',
icon: 'clear_all'
},
{
@ -282,7 +280,7 @@ class LoginSection extends connect(store)(LitElement) {
<div page="seed" id="seedPage">
<div>
<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>
@ -362,10 +360,10 @@ class LoginSection extends connect(store)(LitElement) {
this.selectedPage = 'unlockStored'
}
removeWallet(walletAddress){
if(window.confirm('Are you sure you want to remove this wallet from saved wallets?')) {
removeWallet(walletAddress) {
if (window.confirm('Are you sure you want to remove this wallet from saved wallets?')) {
delete store.getState().user.storedWallets[walletAddress]
this.wallets=store.getState().user.storedWallets
this.wallets = store.getState().user.storedWallets
store.dispatch(
doRemoveWallet(walletAddress)
)//.catch(err => console.error(err))
@ -439,15 +437,15 @@ class LoginSection extends connect(store)(LitElement) {
}
showPassword(selectedPage) {
let willBeShown= (
let willBeShown = (
this.saveInBrowser && [
'unlockBackedUpSeed',
'seed',
'phrase'
].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()
return willBeShown
@ -475,10 +473,10 @@ class LoginSection extends connect(store)(LitElement) {
},
phrase: () => {
const seedPhrase = this.shadowRoot.querySelector('#existingSeedPhraseInput').value
if (seedPhrase == "") {
throw new Error('Please enter a seedphrase')
return
}
if (seedPhrase == "") {
throw new Error('Please enter a seedphrase')
return
}
const name = this.shadowRoot.getElementById('nameInput').value
const password = this.shadowRoot.getElementById('password').value
return {