<commit_before>import React, {Component} from "react";
import {FormattedDate} from "react-intl";
import Translate from "react-translate-component";
import WalletActions from "actions/WalletActions";
import WalletDb from "stores/WalletDb";
import {hash} from "bitsharesjs";

export default class BackupBrainkey extends Component {
    constructor() {
        super();
        this.state = this._getInitialState();
    }

    _getInitialState() {
        return {
            password: <PASSWORD>,
            brainkey: null,
            invalid_password: false
        };
    }

    render() {
        var content;
        var brainkey_backup_date = WalletDb.getWallet().brainkey_backup_date;

        var brainkey_backup_time = brainkey_backup_date ? (
            <div>
                <Translate content="wallet.brainkey_backed_up" />:{" "}
                <FormattedDate value={brainkey_backup_date} />
            </div>
        ) : (
            <Translate
                className="facolor-error"
                component="p"
                content="wallet.brainkey_not_backed_up"
            />
        );

        if (this.state.verified) {
            var sha1 = hash
                .sha1(this.state.brainkey)
                .toString("hex")
                .substring(0, 4);
            content = (
                <div>
                    <h3>
                        <Translate content="wallet.brainkey" />
                    </h3>
                    <div className="card">
                        <div className="card-content">
                            <h5>{this.state.brainkey}</h5>
                        </div>
                    </div>
                    <br />
                    <pre className="no-overflow">
                        sha1 hash of the brainkey: {sha1}
                    </pre>
                    <br />
                    {brainkey_backup_time}
                </div>
            );
        }

        if (!content && this.state.brainkey) {
            var sha1 = hash
                .sha1(this.state.brainkey)
                .toString("hex")
                .substring(0, 4);
            content = (
                <span>
                    <h3>
                        <Translate content="wallet.brainkey" />
                    </h3>
                    <div className="card">
                        <div className="card-content">
                            <h5>{this.state.brainkey}</h5>
                        </div>
                    </div>
                    <div style={{padding: "10px 0"}}>
                        <pre className="no-overflow">
                            sha1 hash of your brainkey: {sha1}
                        </pre>
                    </div>
                    <hr />
                    <div style={{padding: "10px 0 20px 0"}}>
                        <Translate content="wallet.brainkey_w1" />
                        <br />
                        <Translate content="wallet.brainkey_w2" />
                        <br />
                        <Translate content="wallet.brainkey_w3" />
                    </div>

                    <button
                        className="button success"
                        onClick={this.onComplete.bind(this)}
                    >
                        <Translate content="wallet.verify" />
                    </button>
                    <button
                        className="button cancel"
                        onClick={this.reset.bind(this)}
                    ><commit_msg>#1947 Update Foundation Card to Ant Card<commit_after>import React, {Component} from "react";
import {FormattedDate} from "react-intl";
import Translate from "react-translate-component";
import WalletActions from "actions/WalletActions";
import WalletDb from "stores/WalletDb";
import {hash} from "bitsharesjs";
import {Card} from "bitshares-ui-style-guide";

export default class BackupBrainkey extends Component {
    constructor() {
        super();
        this.state = this._getInitialState();
    }

    _getInitialState() {
        return {
            password: <PASSWORD>,
            brainkey: null,
            invalid_password: false
        };
    }

    render() {
        var content;
        var brainkey_backup_date = WalletDb.getWallet().brainkey_backup_date;

        var brainkey_backup_time = brainkey_backup_date ? (
            <div>
                <Translate content="wallet.brainkey_backed_up" />:{" "}
                <FormattedDate value={brainkey_backup_date} />
            </div>
        ) : (
            <Translate
                className="facolor-error"
                component="p"
                content="wallet.brainkey_not_backed_up"
            />
        );

        if (this.state.verified) {
            var sha1 = hash
                .sha1(this.state.brainkey)
                .toString("hex")
                .substring(0, 4);
            content = (
                <div>
                    <h3>
                        <Translate content="wallet.brainkey" />
                    </h3>
                    <Card>{this.state.brainkey}</Card>
                    <br />
                    <pre className="no-overflow">
                        sha1 hash of the brainkey: {sha1}
                    </pre>
                    <br />
                    {brainkey_backup_time}
                </div>
            );
        }

        if (!content && this.state.brainkey) {
            var sha1 = hash
                .sha1(this.state.brainkey)
                .toString("hex")
                .substring(0, 4);
            content = (
                <span>
                    <h3>
                        <Translate content="wallet.brainkey" />
                    </h3>
                    <Card>{this.state.brainkey}</Card>
                    <div style={{padding: "10px 0"}}>
                        <pre className="no-overflow">
                            sha1 hash of your brainkey: {sha1}
                        </pre>
                    </div>
                    <hr />
                    <div style={{padding: "10px 0 20px 0"}}>
                        <Translate content="wallet.brainkey_w1" />
                        <br />
                        <Translate content="wallet.brainkey_w2" />
                        <br />
                        <Translate content="wallet.brainkey_w3" />
                    </div>

                    <button
                        className="button success"
                        onClick={this.onComplete.bind(this)}
                    >
                        <Translate content="wallet.verify" />
                    </button>
                    <button
                        className="button cancel"
                        onClick={this.reset.bind(this)}
                    >
{'fraction_non_alphanumeric': 0.1055636896046852, 'fraction_numerical': 0.009370424597364568, 'mean_word_length': 1.0439856373429084, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7378089', 'n_tokens_mistral': 1793, 'n_tokens_neox': 1645, 'n_words': 320}