Skip to content

Commit

Permalink
Merge pull request #10 from sayoungestguy/origin/develop/weijie/Email…
Browse files Browse the repository at this point in the history
…Service

integrated with dev branch n tested email services
  • Loading branch information
Lee-Wei-Jie authored Sep 8, 2024
2 parents 53b7edb + b0f07a7 commit 0cb9e71
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/main/resources/.h2.server.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#H2 Server Properties
#Sat Sep 07 22:31:28 SGT 2024
0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/scaleup|scaleup
webAllowOthers=true
webPort=8092
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const PasswordResetFinishPage = () => {
data-cy="confirmResetPassword"
/>
<Button color="success" type="submit" data-cy="submit">
Validate new password
Update to new password
</Button>
</ValidatedForm>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ export const PasswordResetSlice = createSlice({
.addCase(handlePasswordResetFinish.fulfilled, () => ({
...initialState,
loading: false,
//password reset state set to success

Check warning on line 50 in src/main/webapp/app/modules/account/password-reset/password-reset.reducer.ts

View workflow job for this annotation

GitHub Actions / Frontend Test Stage

Expected space or tab after '//' in comment
resetPasswordSuccess: true,
successMessage: "Your password couldn't be reset. Remember a password request is only valid for 24 hours.",
//successMessage: "Your password couldn't be reset. Remember a password request is only valid for 24 hours.",

Check warning on line 52 in src/main/webapp/app/modules/account/password-reset/password-reset.reducer.ts

View workflow job for this annotation

GitHub Actions / Frontend Test Stage

Expected space or tab after '//' in comment
//scrape 24h thinggy? since cant demo

Check warning on line 53 in src/main/webapp/app/modules/account/password-reset/password-reset.reducer.ts

View workflow job for this annotation

GitHub Actions / Frontend Test Stage

Expected space or tab after '//' in comment
successMessage: 'Your password reset have been completed successfully',
}))
.addMatcher(isPending(handlePasswordResetInit, handlePasswordResetFinish), state => {
state.loading = true;
})
//A matcher function to handle actions that have been rejected

Check warning on line 59 in src/main/webapp/app/modules/account/password-reset/password-reset.reducer.ts

View workflow job for this annotation

GitHub Actions / Frontend Test Stage

Expected space or tab after '//' in comment
//resets the state to initialState, sets loading to false, and marks the operation as failed with a relevant flag (resetPasswordFailure)

Check warning on line 60 in src/main/webapp/app/modules/account/password-reset/password-reset.reducer.ts

View workflow job for this annotation

GitHub Actions / Frontend Test Stage

Expected space or tab after '//' in comment
.addMatcher(isRejected(handlePasswordResetInit, handlePasswordResetFinish), () => ({
...initialState,
loading: false,
Expand Down
48 changes: 39 additions & 9 deletions src/main/webapp/app/modules/login/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,50 @@
import React, { useLayoutEffect } from 'react';
import React, { useLayoutEffect, useState, useEffect } from 'react';

import { useAppDispatch, useAppSelector } from 'app/config/store';
import { logout } from 'app/shared/reducers/authentication';

// export const Logout = () => {
// const authentication = useAppSelector(state => state.authentication);
// const dispatch = useAppDispatch();

// useLayoutEffect(() => {
// dispatch(logout());
// if (authentication.logoutUrl) {
// window.location.href = authentication.logoutUrl;
// } else if (!authentication.isAuthenticated) {
// window.location.href = '/';
// }
// });

// return (
// <div className="p-5">
// <h4>Logged out successfully!</h4>
// </div>
// );
// };

export const Logout = () => {
const [isRedirecting, setIsRedirecting] = useState(false);
const authentication = useAppSelector(state => state.authentication);
const dispatch = useAppDispatch();

useLayoutEffect(() => {
dispatch(logout());
if (authentication.logoutUrl) {
window.location.href = authentication.logoutUrl;
} else if (!authentication.isAuthenticated) {
window.location.href = '/';
}
});
useEffect(() => {
const performLogout = async () => {
dispatch(logout());
setIsRedirecting(true); // Set flag to indicate redirection in progress

// Introduce a delay to handle the error boundary clean-up
await new Promise(resolve => setTimeout(resolve, 100)); // Adjust delay as needed

if (authentication.logoutUrl) {
window.location.href = authentication.logoutUrl;
} else if (!authentication.isAuthenticated) {
window.location.href = '/';
}
};

performLogout();
}, [dispatch, authentication]);

return (
<div className="p-5">
Expand Down
10 changes: 4 additions & 6 deletions src/main/webapp/app/shared/layout/footer/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import './footer.scss';

import React from 'react';

import { Col, Row } from 'reactstrap';

const Footer = () => (
<div className="footer page-content">
<footer className="footer">
<Row>
<Col md="12">
<p>This is your footer</p>
<Col md="12" className="text-center">
<p>&copy; {new Date().getFullYear()} Scaleup. All rights reserved.</p>
</Col>
</Row>
</div>
</footer>
);

export default Footer;

0 comments on commit 0cb9e71

Please sign in to comment.