mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Merge pull request #1766 from LemmyNet/auth-error-message
Prevent JWT token from showing up on error page
This commit is contained in:
commit
ce1f979c36
4 changed files with 1253 additions and 940 deletions
|
@ -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>
|
||||
|
|
|
@ -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,
|
||||
|
|
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