mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +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 { setIsoData } from "@utils/app";
|
||||||
|
import { removeAuthParam } from "@utils/helpers";
|
||||||
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>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import isCakeDay from "./is-cake-day";
|
||||||
import numToSI from "./num-to-si";
|
import numToSI from "./num-to-si";
|
||||||
import poll from "./poll";
|
import poll from "./poll";
|
||||||
import randomStr from "./random-str";
|
import randomStr from "./random-str";
|
||||||
|
import removeAuthParam from "./remove-auth-param";
|
||||||
import sleep from "./sleep";
|
import sleep from "./sleep";
|
||||||
import validEmail from "./valid-email";
|
import validEmail from "./valid-email";
|
||||||
import validInstanceTLD from "./valid-instance-tld";
|
import validInstanceTLD from "./valid-instance-tld";
|
||||||
|
@ -43,6 +44,7 @@ export {
|
||||||
numToSI,
|
numToSI,
|
||||||
poll,
|
poll,
|
||||||
randomStr,
|
randomStr,
|
||||||
|
removeAuthParam,
|
||||||
sleep,
|
sleep,
|
||||||
validEmail,
|
validEmail,
|
||||||
validInstanceTLD,
|
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