mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Prevent JWT token from showing up on error page
This commit is contained in:
parent
3e7aca043b
commit
31789495a2
2 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { setIsoData } from "@utils/app";
|
import { setIsoData } from "@utils/app";
|
||||||
|
import removeAuthParam from "@utils/helpers/remove-auth-param";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import { T } from "inferno-i18next-dess";
|
import { T } from "inferno-i18next-dess";
|
||||||
import { Link } from "inferno-router";
|
import { Link } from "inferno-router";
|
||||||
|
@ -58,7 +59,7 @@ export class ErrorPage extends Component<any, any> {
|
||||||
<T
|
<T
|
||||||
i18nKey="error_code_message"
|
i18nKey="error_code_message"
|
||||||
parent="p"
|
parent="p"
|
||||||
interpolation={{ error: errorPageData.error }}
|
interpolation={{ error: removeAuthParam(errorPageData.error) }}
|
||||||
>
|
>
|
||||||
#<strong className="text-danger">#</strong>#
|
#<strong className="text-danger">#</strong>#
|
||||||
</T>
|
</T>
|
||||||
|
|
6
src/shared/utils/helpers/remove-auth-param.ts
Normal file
6
src/shared/utils/helpers/remove-auth-param.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export default function (err: any) {
|
||||||
|
return err
|
||||||
|
.toString()
|
||||||
|
.replace(new RegExp("[?&]auth=[^&#]*(#.*)?$"), "$1")
|
||||||
|
.replace(new RegExp("([?&])auth=[^&]*&"), "$1");
|
||||||
|
}
|
Loading…
Reference in a new issue