import React from "react";
import { BusyMessage } from "component/common";
import UserEmailNew from "component/userEmailNew";
import UserEmailVerify from "component/userEmailVerify";
import UserVerify from "component/userVerify";
export class AuthPage extends React.PureComponent {
/*
{newUserReward &&
}
Welcome to LBRY
{" "}{__(
"Claim your welcome credits to be able to publish content, pay creators, and have a say over the LBRY network."
)}
*/
componentWillMount() {
console.log("will mount");
this.navigateIfAuthenticated(this.props);
}
componentWillReceiveProps(nextProps) {
console.log("will receive");
this.navigateIfAuthenticated(nextProps);
}
navigateIfAuthenticated(props) {
const { isPending, user } = props;
console.log(props);
if (
!isPending &&
user &&
user.has_verified_email &&
user.is_identity_verified
) {
props.onAuthComplete();
}
}
getTitle() {
const { email, isPending, isVerificationCandidate, user } = this.props;
if (isPending || (user && !user.has_verified_email && !email)) {
return __("Welcome to LBRY");
} else if (user && !user.has_verified_email) {
return __("Confirm Email");
} else if (user && !user.is_identity_verified) {
return __("Confirm Identity");
} else {
return __("Welcome to LBRY");
}
}
renderMain() {
const { email, isPending, isVerificationCandidate, user } = this.props;
if (isPending) {
return ;
} else if (user && !user.has_verified_email && !email) {
return ;
} else if (user && !user.has_verified_email) {
return ;
} else if (user && !user.is_identity_verified) {
return ;
} else {
return {__("No further steps.")};
}
}
render() {
const { email, hasEmail, isPending } = this.props;
return (
{this.getTitle()}
{!isPending &&
!email &&
!hasEmail &&
{__("Create a verified identity and receive LBC rewards.")}
}
{this.renderMain()}
{__(
"This information is disclosed only to LBRY, Inc. and not to the LBRY network. It is collected to provide communication and prevent abuse."
)}
);
}
}
export default AuthPage;