Merge pull request #1766 from LemmyNet/auth-error-message

Prevent JWT token from showing up on error page
This commit is contained in:
SleeplessOne1917 2023-07-02 22:37:37 +00:00 committed by GitHub
commit ce1f979c36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1253 additions and 940 deletions

View file

@ -1,4 +1,5 @@
import { setIsoData } from "@utils/app";
import { removeAuthParam } from "@utils/helpers";
import { Component } from "inferno";
import { T } from "inferno-i18next-dess";
import { Link } from "inferno-router";
@ -58,7 +59,7 @@ export class ErrorPage extends Component<any, any> {
<T
i18nKey="error_code_message"
parent="p"
interpolation={{ error: errorPageData.error }}
interpolation={{ error: removeAuthParam(errorPageData.error) }}
>
#<strong className="text-danger">#</strong>#
</T>

View file

@ -17,6 +17,7 @@ import isCakeDay from "./is-cake-day";
import numToSI from "./num-to-si";
import poll from "./poll";
import randomStr from "./random-str";
import removeAuthParam from "./remove-auth-param";
import sleep from "./sleep";
import validEmail from "./valid-email";
import validInstanceTLD from "./valid-instance-tld";
@ -43,6 +44,7 @@ export {
numToSI,
poll,
randomStr,
removeAuthParam,
sleep,
validEmail,
validInstanceTLD,

View file

@ -0,0 +1,6 @@
export default function (err: any) {
return err
.toString()
.replace(new RegExp("[?&]auth=[^&#]*(#.*)?$"), "$1")
.replace(new RegExp("([?&])auth=[^&]*&"), "$1");
}

2182
yarn.lock

File diff suppressed because it is too large Load diff