todos-contra-el-fuego-web/imports/ui/pages/VerifyEmail/VerifyEmail.js
vjrj a1a1b9a801 deps: react-bootstrap 0.31 -> 2 (Bootstrap 5 CSS deferred as debt)
Removes the largest batch of React-19-blocking warnings: the 0.31
components (Grid, FormGroup, ControlLabel, Navbar.Header/Brand, Checkbox,
SafeAnchor) all leaned on legacy context / defaultProps.

29 files converted: Grid->Container, FormGroup/ControlLabel/FormControl/
HelpBlock -> Form.Group/Label/Control/Text, Checkbox -> Form.Check (label
as prop), bsStyle->variant (default->secondary), bsSize->size,
pull-right->float-end. Custom Col.js now re-exports v2's Col; custom
NavItem.js rewritten self-contained (no SafeAnchor/createChainedFunction);
Navigation.js drops react-bootstrap Navbar (raw markup anyway).

CSS stays on Bootstrap 4 (alexwine:bootstrap-4) for now: the BS4->5 jump
is entangled with the jQuery carousel/swipe + navbar-collapse and is
tracked as separate debt in UPGRADE.md. Only .form-label needed a shim
(forms.scss). Browser-verified home carousel+navbar, signup form + terms
checkbox, login form; REST smoke byte-identical.
2026-07-21 12:44:46 +02:00

51 lines
1.6 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Alert } from 'react-bootstrap';
import { Meteor } from 'meteor/meteor';
import { Helmet } from 'react-helmet-async';
import { Accounts } from 'meteor/accounts-base';
import { Bert } from 'meteor/themeteorchef:bert';
import { withTranslation } from 'react-i18next';
import { T9n } from 'meteor-accounts-t9n';
class VerifyEmail extends React.Component {
constructor(props) {
super(props);
this.t = props.t;
this.state = { error: null };
}
componentDidMount() {
const { match, history } = this.props;
Accounts.verifyEmail(match.params.token, (error) => {
if (error) {
Bert.alert(T9n.get(`error.accounts.${error.reason}`), 'danger');
this.setState({ error: `${T9n.get(`error.accounts.${error.reason}`)}. ${this.t('Por favor, inténtalo otra vez.')}` });
// this.setState({ error: `${error.reason}. Please try again.` });
} else {
setTimeout(() => {
Bert.alert(this.t('¡Listo, gracias!'), 'success');
history.push('/subscriptions');
}, 1500);
}
});
}
render() {
return (<div className="VerifyEmail">
<Helmet>
<title>{this.t('AppName')}: {this.t('Verifica tu dirección de correo')}</title>
</Helmet>
<Alert variant={!this.state.error ? 'info' : 'danger'}>
{!this.state.error ? this.t('Verificando...') : this.state.error}
</Alert>
</div>);
}
}
VerifyEmail.propTypes = {
match: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
};
export default withTranslation()(VerifyEmail);