Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = 'pl.databucket'
version = '3.3.3'
version = '3.4.0'
targetCompatibility = 8
sourceCompatibility = 8

Expand Down Expand Up @@ -34,6 +34,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.7'
implementation 'org.springframework.boot:spring-boot-starter-security:2.5.7'
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.5.7'
implementation 'org.springframework.boot:spring-boot-starter-mail:2.5.7'
implementation 'org.springframework:spring-tx:5.3.9'
implementation 'org.postgresql:postgresql:42.2.23.jre7'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.1'
Expand All @@ -50,17 +51,17 @@ dependencies {
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok'

testImplementation('org.springframework.boot:spring-boot-starter-test:2.5.4') {exclude group: 'junit', module: 'junit'}
// testImplementation('org.springframework.boot:spring-boot-starter-test:2.5.4') {exclude group: 'junit', module: 'junit'}

// JUnit dependencies
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.2'
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.7.2'
// testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
// testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.2'
// testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.7.2'

// Spock - Mandatory dependencies
testImplementation 'org.codehaus.groovy:groovy-all:3.0.8'
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
testImplementation 'org.spockframework:spock-spring:2.0-groovy-3.0'
// testImplementation 'org.codehaus.groovy:groovy-all:3.0.8'
// testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
// testImplementation 'org.spockframework:spock-spring:2.0-groovy-3.0'
}

test {
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"homepage": ".",
"name": "databucket",
"version": "3.3.3",
"version": "3.4.0",
"private": true,
"dependencies": {
"@material-ui/core": "4.12.4",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dialogs/InfoDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function InfoDialog() {
>
<img style={{marginLeft: '100px', marginTop: '20px'}} src={DatabucketLogo} alt='' width='399' height='65'/>
<div style={{margin: '20px'}}>
<Typography color='secondary'>Version: <b>3.3.3</b></Typography>
<Typography color='secondary'>Version: <b>3.4.0</b></Typography>
<Link target='_blank' href='https://www.databucket.pl' color="primary">www.databucket.pl</Link><br/>
<Link target='_blank' href='https://github.com/databucket/databucket-server' color="textSecondary">Source code</Link><br/>
<Link target='_blank' href='https://github.com/databucket/databucket-server/wiki' color="textSecondary">Documentation</Link><br/>
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/components/login/ChangePasswordPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {fetchHelper, handleErrors} from "../../utils/FetchHelper";
import {Redirect} from "react-router-dom";
import {getProjectDataPath} from "../../route/AppRouter";
import {getBaseUrl} from "../../utils/UrlBuilder";
import Link from "@material-ui/core/Link";

const initialState = {
password: "",
Expand All @@ -21,6 +22,7 @@ const initialState = {
};

export default function ChangePasswordPage() {
const [back, setBack] = useState(false);
const [{password, newPassword, newPasswordConfirmation}, setState] = useState(initialState);
const [messageBox, setMessageBox] = useState({open: false, severity: 'error', title: '', message: ''});
const [redirect, setRedirect] = useState(false);
Expand Down Expand Up @@ -82,6 +84,9 @@ export default function ChangePasswordPage() {
getPasswordStrength(value);
};

if (back)
return (<Redirect to="/login"/>);
else
return (
redirect === true ? (
<Redirect to={getProjectDataPath()}/>
Expand All @@ -91,6 +96,16 @@ export default function ChangePasswordPage() {
<Typography className="Title" variant="h5">
Change password
</Typography>
{/*// additional control to block setting default password by Chrome*/}
<FormControl disabled={true} style={{height: '0px', width: '0px'}}>
<Input
name="pass"
type='password'
value={null}
disabled={true}
// visible={false}
/>
</FormControl>
<FormControl className="LoginInputText">
<InputLabel htmlFor="standard-adornment-password">Current password</InputLabel>
<Input
Expand Down Expand Up @@ -120,6 +135,7 @@ export default function ChangePasswordPage() {
</FormControl>
<div className="Button">
<Button
fullWidth={true}
variant="contained"
color="primary"
disabled={
Expand All @@ -132,6 +148,17 @@ export default function ChangePasswordPage() {
Submit
</Button>
</div>
<div className="BackLink">
<Link
component="button"
color="inherit"
onClick={() => {
setBack(true);
}}
>
Back
</Link>
</div>
</Paper>
<MessageBox
config={messageBox}
Expand Down
58 changes: 58 additions & 0 deletions frontend/src/components/login/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, {useEffect, useState} from "react";
import "./SignUpPage.css";
import Logo from "../../images/databucket-logo.png";
import {Paper} from "@material-ui/core";
import Typography from "@material-ui/core/Typography";
import {MessageBox} from "../utils/MessageBox";
import {Redirect, useParams} from "react-router-dom";
import {getConfirmationUrl} from "../../utils/UrlBuilder";
import {handleErrors} from "../../utils/FetchHelper";
import {getGetOptions} from "../../utils/MaterialTableHelper";

export default function ConfirmationPage() {

const inputParams = useParams();
const [messageBox, setMessageBox] = useState({open: false, severity: 'error', title: '', message: ''});
const [done, setDone] = useState(false);
const [redirect, setRedirect] = useState(false);

useEffect(() => {
let resultOk = true;
fetch(getConfirmationUrl(inputParams[0]), getGetOptions())
.then(handleErrors)
.catch(error => {
setMessageBox({open: true, severity: 'error', title: 'Error', message: error});
resultOk = false;
})
.then(response => {
if (resultOk) {
setDone(true);
setTimeout(() => {
setRedirect(true);
}, 6000)
}
});
}, [inputParams]);

if (redirect)
return (<Redirect to="/login"/>);
else
return (
<div className="ContainerClass">
{<img src={Logo} alt=''/>}
<Paper className="PaperClass" elevation={3}>
<Typography className="Title" variant="h5">
Confirmation
</Typography>
<div style={{height: '100px'}}/>
<Typography className="Description">
{!done ? "Processing..." : "Check your email inbox."}
</Typography>
</Paper>
<MessageBox
config={messageBox}
onClose={() => setMessageBox({...messageBox, open: false})}
/>
</div>
);
}
57 changes: 57 additions & 0 deletions frontend/src/components/login/ForgotPasswordPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.ContainerClass {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10vh;
}

.PaperClass {
margin-top: 40px;
display: flex;
min-width: 370px;
max-width: 370px;
min-height: 500px;
max-height: 700px;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 20px 0px 0px 0px;
}

.Title {
padding: 30px;
}

.Description {
padding: 30px;
}

.TitleGrid {
padding: 30px;
width: 100%;
/*overflow: auto;*/
}

.Button {
width: 100%;
margin-top: 10px;
padding: 20px;
}

.EmailInputText {
height: 70px;
width: 85%;
overflow: auto;
}

.BackLink {
width: 100%;
margin-top: 50px;
margin-left: 40px;
margin-bottom: 10px;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
}
104 changes: 104 additions & 0 deletions frontend/src/components/login/ForgotPasswordPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import React, {useState} from "react";
import "./ForgotPasswordPage.css";
import Button from "@material-ui/core/Button";
import Logo from "../../images/databucket-logo.png";
import {Input, InputLabel, Paper} from "@material-ui/core";
import Typography from "@material-ui/core/Typography";
import FormControl from "@material-ui/core/FormControl";
import {MessageBox} from "../utils/MessageBox";
import Link from "@material-ui/core/Link";
import {Redirect} from "react-router-dom";
import {getBaseUrl, getContextPath} from "../../utils/UrlBuilder";
import {handleLoginErrors} from "../../utils/FetchHelper";
import {validateEmail} from "../../utils/Misc";

export default function ForgotPasswordPage() {

const [back, setBack] = useState(false);
const [email, setEmail] = useState("");
const [messageBox, setMessageBox] = useState({open: false, severity: 'error', title: '', message: ''});

const onChange = e => {
setEmail(e.target.value);
};

const handleReset = () => {
fetch(getBaseUrl('public/forgot-password'), {
method: 'POST',
body: JSON.stringify({email: email, url: window.location.origin + getContextPath() + "/confirmation/forgot-password/"}),
headers: {'Content-Type': 'application/json'}
})
.then(handleLoginErrors)
.then(response => {
setMessageBox({open: true, severity: 'info', title: 'Send confirmation email', message: null});
}).catch(error => {
setMessageBox({open: true, severity: 'error', title: 'Sending confirmation password failed', message: error});
}
);
}

const handleKeypress = e => {
if (e.key === 'Enter')
handleReset();
};

if (back)
return (<Redirect to="/login"/>);
else
return (
<div className="ContainerClass">
{<img src={Logo} alt=''/>}
<Paper className="PaperClass" elevation={3}>
<Typography className="Title" variant="h5">
Forgot your password?
</Typography>
<Typography className="Description">
Please enter the email address for your account.
A verification link will be sent to you.
Once you have received the verification link,
you will be able to choose a new password for your account.
</Typography>
<FormControl className="EmailInputText">
<InputLabel htmlFor="standard-adornment-email">Email</InputLabel>
<Input
id="standard-adornment-email"
name="email"
type='email'
value={email}
onChange={onChange}
onKeyPress={(event) => handleKeypress(event)}
/>
</FormControl>
<div className="Button">
<Button
fullWidth={true}
variant="contained"
color="primary"
size={'large'}
disabled={!(validateEmail(email))}
onClick={() => {
handleReset();
}}
>
Submit
</Button>
</div>
<div className="BackLink">
<Link
component="button"
color="inherit"
onClick={() => {
setBack(true);
}}
>
Back
</Link>
</div>
</Paper>
<MessageBox
config={messageBox}
onClose={() => setMessageBox({...messageBox, open: false})}
/>
</div>
);
}
Loading