Skip to content

Commit

Permalink
fix unable to login due to old cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
themrphantom committed Nov 26, 2024
1 parent 744800e commit 6112431
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/Components/Common/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ const Login = (props: Props) => {
const [disableLoginButton, setdisableLoginButton] = useState(false)
const [username, setusername] = useState("")
const [password, setpassword] = useState("")

const clearCookies = () => {
//clear only username and password cookies
document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
document.cookie = "memberID=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
}

const login = () => {
setdisableLoginButton(true);
clearCookies();
(function () {
var cookies = document.cookie.split("; ");
for (var c = 0; c < cookies.length; c++) {
Expand Down Expand Up @@ -51,6 +58,7 @@ const Login = (props: Props) => {

const loginOidc = async () => {
setdisableLoginButton(true)
clearCookies();
doGetRequest("start-oidc").then(value => {
if (value.code === 200) {
console.log(value.content)
Expand Down

0 comments on commit 6112431

Please sign in to comment.