import * as React from 'react';
import Container from './widgets/Container';
import ExternalLink from './widgets/ExternalLink';
import SyncGate from './SyncGate';
import LoginForm from './components/LoginForm';
import EncryptionLoginForm from './components/EncryptionLoginForm';
import { store, CredentialsType } from './store';
import { login, deriveKey } from './store/actions';
import * as C from './constants';
const SignedPagesBadge = require('./images/signed-pages-badge.svg');
class LoginGate extends React.Component {
props: {
credentials: CredentialsType;
};
constructor(props: any) {
super(props);
this.onFormSubmit = this.onFormSubmit.bind(this);
this.onEncryptionFormSubmit = this.onEncryptionFormSubmit.bind(this);
}
onFormSubmit(username: string, password: string, encryptionPassword: string, serviceApiUrl?: string) {
serviceApiUrl = serviceApiUrl ? serviceApiUrl : C.serviceApiBase;
store.dispatch(login(username, password, encryptionPassword, serviceApiUrl));
}
onEncryptionFormSubmit(encryptionPassword: string) {
store.dispatch(deriveKey(this.props.credentials.value!.credentials.email, encryptionPassword));
}
render() {
if (this.props.credentials.value === null) {
const style = {
isSafe: {
textDecoration: 'none',
display: 'block',
},
divider: {
margin: '30px 0',
color: '#00000025',
}
};
return (
Please Log In
The EteSync Website
Is the web client safe to use?
Source code
);
} else if (this.props.credentials.value.encryptionKey === null) {
return (
Encryption Password
You are logged in as {this.props.credentials.value.credentials.email}.
Please enter your encryption password to continue, or log out from the side menu.