Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
danbryce committed Feb 15, 2022
2 parents 4a2dd2e + 57a67fe commit ee06223
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 7 deletions.
1 change: 1 addition & 0 deletions frontend/web/src/DISCLAIMER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disclaimer: The public server https://pamled.sift.net is currently intended to serve as an evaluation version of PAMLED, and users should assume that user data will NOT be preserved in perpetuity (yet, protocols can be downloaded). PAMLED manages account credentials through Django (using PBKDF2 encryption) and stores protocol-related data in clear text within a publicly-inaccessible database. The web application also uses cookies to record session ids.
56 changes: 56 additions & 0 deletions frontend/web/src/editor/DisclaimerModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, { Component } from 'react';
import { Modal, Button, Alert, Spinner, Row, Col } from 'react-bootstrap';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import marked from "marked";


export default class DisclaimerModal extends Component {

state = {};

componentDidMount() {
const readmePath = require("../DISCLAIMER.md");

fetch(readmePath)
.then(response => {
return response.text()
})
.then(text => {
this.setState({
markdown: text
})
})
}


render() {

const { markdown } = this.state;
return (

<Modal
show={this.props.show}
size="lg"
aria-labelledby="contained-modal-title-vcenter"
centered
>
<Modal.Header>
{/* <Modal.Title id="contained-modal-title-vcenter">
PAMLED User Guide
</Modal.Title> */}
</Modal.Header>
<Modal.Body>
<ReactMarkdown children={markdown} />

</Modal.Body>
<Modal.Footer>
<Button className="user-guide" variant="primary" onClick={() => this.props.handleDone()}>
Done
</Button>
</Modal.Footer>
</Modal>
);
}
}

37 changes: 30 additions & 7 deletions frontend/web/src/routes/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from "react";
import { Row, Col } from "react-bootstrap"
import { withRouter, queryLoginStatus } from "../utils";
import LoginStatus from '../login/LoginStatus';
import DisclaimerModal from "../editor/DisclaimerModal"

class Login extends React.Component {
constructor(props) {
Expand All @@ -10,6 +12,7 @@ class Login extends React.Component {
password: "",
error: "",
isAuthenticated: null,
disclaimerVisible: true
};
this.whoami = this.whoami.bind(this);

Expand All @@ -18,10 +21,12 @@ class Login extends React.Component {
this.handlePasswordChange = this.handlePasswordChange.bind(this);
this.handleEmailChange = this.handleEmailChange.bind(this);
this.onAuthenticationChanged = this.onAuthenticationChanged.bind(this);
this.onDisclaimer = this.onDisclaimer.bind(this);
this.onDisclaimerDone = this.onDisclaimerDone.bind(this);

this.loginStatus = React.createRef();
}

handlePasswordChange(event) {
this.setState({password: event.target.value});
}
Expand All @@ -33,10 +38,17 @@ class Login extends React.Component {
onAuthenticationChanged(isAuthenticated) {
this.setState({ isAuthenticated: isAuthenticated });
if (isAuthenticated) {
this.props.navigate("/editor");
this.props.navigate("/editor");
}
}

onDisclaimerDone(){
this.setState({ disclaimerVisible: null })
}
onDisclaimer(){
this.setState({ disclaimerVisible: true })
}

whoami() {
queryLoginStatus((data) => {
console.log("You are logged in as: " + data.email);
Expand Down Expand Up @@ -76,7 +88,7 @@ class Login extends React.Component {
</div>
);
}

return (
<div className="container">
<h1>PAML Editor</h1>
Expand Down Expand Up @@ -108,10 +120,21 @@ class Login extends React.Component {

render() {
return (
<div className="container mt-3">
<LoginStatus ref={this.loginStatus} onAuthenticationChanged={this.onAuthenticationChanged} />
{this.renderLogin()}
</div>
<Col>
<Row md={8}>
<div className="container mt-3">
<LoginStatus ref={this.loginStatus} onAuthenticationChanged={this.onAuthenticationChanged} />
{this.renderLogin()}
</div>
</Row>
<Row></Row>
<Row md={8}>
<DisclaimerModal
show={this.state.disclaimerVisible !== null}
handleDone={() => this.onDisclaimerDone()}
/>
</Row>
</Col>
);
}
}
Expand Down

0 comments on commit ee06223

Please sign in to comment.