Skip to content

Commit

Permalink
Merge pull request #256 from kumanik5661/login-redirection
Browse files Browse the repository at this point in the history
Fix Login redirection to Arduino frontend from forgot password workflow
  • Loading branch information
firuza authored May 30, 2021
2 parents 72073bb + 3b2803d commit 9a71279
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion eda-frontend/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default function SignIn (props) {
useEffect(() => {
dispatch(authDefault())
document.title = 'Login - eSim '
if (props.location.search !== '') {
const ardUrl = localStorage.getItem('ard_redurl')
if (ardUrl && ardUrl !== '') {
url = ardUrl
} else if (props.location.search !== '') {
const query = new URLSearchParams(props.location.search)
url = query.get('url')
localStorage.setItem('ard_redurl', url)
Expand Down
2 changes: 1 addition & 1 deletion eda-frontend/src/pages/ResetPassword/Initiation.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function ResetPassword () {
fullWidth
variant="contained"
color="primary"
onClick={() => dispatch(resetPassword(email))}
onClick={() => { email.length > 0 && dispatch(resetPassword(email)) }}
className={classes.submit}
disabled={false}
>
Expand Down
1 change: 1 addition & 0 deletions eda-frontend/src/redux/actions/authActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const login = (username, password, toUrl) => {
dispatch(loadUser())
} else {
window.open(toUrl, '_self')
localStorage.setItem('ard_redurl', '')
}
} else if (res.status === 400 || res.status === 403 || res.status === 401) {
dispatch({
Expand Down

0 comments on commit 9a71279

Please sign in to comment.