Skip to content
Snippets Groups Projects
Select Git revision
  • EMERGENCY-BRANCH-batch-all-messages
  • main default protected
  • 113-ban
  • hf-harden-intervals-and-info-response
  • 201-load-tests
  • 363-publish-privacy-policy
  • WIP-docker-module
  • ni-splash-how-to-updates
  • hotfix-safely-destructure-identity-errors
  • hotfix-bump-pool-size-to-1
  • WIP-177-german-l10n-readme
  • try-to-trigger-rate-limit
12 results

docker-compose-dev.yml

Blame
  • Forked from team-friendo / signalboost
    Source project has a limited visibility.
    OwnPassword.js 1.51 KiB
    import React, { useState } from "react";
    import { Form, Col, Row, Button, Alert } from "react-bootstrap";
    import PasswordForm from "./PasswordForm";
    import Sender from "./Sender";
    
    function OwnPassword() {
      const [old_password, setOldPassword] = useState("");
      const [password, setPassword] = useState("");
      const [isFormValid, setIsFormValid] = useState(false);
      const [passwordChanged, setPasswordChanged] = useState(false);
    
      return (
        <Sender
          url="/api/member/me"
          method="PUT"
          body={{ old_password, password }}
          onSuccess={() => setPasswordChanged(true)}
        >
          <h2>Cambio de contraseña</h2>
    
          {passwordChanged && (
            <Alert variant="success">La contraseña se ha cambiado con éxito.</Alert>
          )}
    
          <Form.Group as={Row}>
            <Form.Label as="legend" column sm={4}>
              Contraseña actual
            </Form.Label>
            <Col sm={8}>
              <Form.Control
                placeholder="Contraseña actual"
                type="password"
                value={old_password}
                onChange={(e) => setOldPassword(e.target.value)}
              />
            </Col>
          </Form.Group>
    
          <PasswordForm
            password={password}
            onChange={setPassword}
            setValid={setIsFormValid}
          />
          <Form.Group as={Row}>
            <Col sm={{ offset: 4, span: 8 }}>
              <Button type="submit" variant="primary" disabled={!isFormValid}>
                Cambiar la contraseña
              </Button>
            </Col>
          </Form.Group>
        </Sender>
      );
    }
    
    export default OwnPassword;