mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 11:21:52 +03:00
Warn on Access Token reveal
Signed-off-by: Resynth <resynth1943@tutanota.com>
This commit is contained in:
parent
d5e9d5306a
commit
e33f4ba9c0
2 changed files with 52 additions and 1 deletions
39
src/components/views/dialogs/AccessTokenDialog.tsx
Normal file
39
src/components/views/dialogs/AccessTokenDialog.tsx
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
Copyright 2017 Vector Creations Ltd
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import { _t } from '../../../languageHandler';
|
||||||
|
import QuestionDialog from './QuestionDialog';
|
||||||
|
|
||||||
|
type IProps = Exclude<
|
||||||
|
React.ComponentProps<QuestionDialog>,
|
||||||
|
"title" | "danger" | "description"
|
||||||
|
>;
|
||||||
|
|
||||||
|
export default function AccessTokenDialog (props: IProps) {
|
||||||
|
return (
|
||||||
|
<QuestionDialog
|
||||||
|
{...props}
|
||||||
|
title="Reveal Access Token"
|
||||||
|
danger={true}
|
||||||
|
description={_t(
|
||||||
|
"Do not reveal your Access Token to anyone, under any circumstances. " +
|
||||||
|
"Sharing your Access Token with someone would allow them to login to " +
|
||||||
|
"your account, and access your private information."
|
||||||
|
)}
|
||||||
|
></QuestionDialog>
|
||||||
|
);
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ import * as sdk from "../../../../../";
|
||||||
import PlatformPeg from "../../../../../PlatformPeg";
|
import PlatformPeg from "../../../../../PlatformPeg";
|
||||||
import * as KeyboardShortcuts from "../../../../../accessibility/KeyboardShortcuts";
|
import * as KeyboardShortcuts from "../../../../../accessibility/KeyboardShortcuts";
|
||||||
import UpdateCheckButton from "../../UpdateCheckButton";
|
import UpdateCheckButton from "../../UpdateCheckButton";
|
||||||
|
import AccessTokenDialog from '../../../dialogs/AccessTokenDialog';
|
||||||
|
|
||||||
export default class HelpUserSettingsTab extends React.Component {
|
export default class HelpUserSettingsTab extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -148,6 +149,17 @@ export default class HelpUserSettingsTab extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAccessTokenSpoilerClick = async (event) => {
|
||||||
|
// React throws away the event before we can use it (we are async, after all).
|
||||||
|
event.persist();
|
||||||
|
|
||||||
|
// We make the user accept a scary popup to combat Social Engineering. No peeking!
|
||||||
|
await Modal.createTrackedDialog('Reveal Access Token', '', AccessTokenDialog).finished;
|
||||||
|
|
||||||
|
// Pass it onto the handler.
|
||||||
|
this._showSpoiler(event);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const brand = SdkConfig.get().brand;
|
const brand = SdkConfig.get().brand;
|
||||||
|
|
||||||
|
@ -266,7 +278,7 @@ export default class HelpUserSettingsTab extends React.Component {
|
||||||
{_t("Homeserver is")} <code>{MatrixClientPeg.get().getHomeserverUrl()}</code><br />
|
{_t("Homeserver is")} <code>{MatrixClientPeg.get().getHomeserverUrl()}</code><br />
|
||||||
{_t("Identity Server is")} <code>{MatrixClientPeg.get().getIdentityServerUrl()}</code><br />
|
{_t("Identity Server is")} <code>{MatrixClientPeg.get().getIdentityServerUrl()}</code><br />
|
||||||
{_t("Access Token:") + ' '}
|
{_t("Access Token:") + ' '}
|
||||||
<AccessibleButton element="span" onClick={this._showSpoiler}
|
<AccessibleButton element="span" onClick={this.onAccessTokenSpoilerClick}
|
||||||
data-spoiler={MatrixClientPeg.get().getAccessToken()}>
|
data-spoiler={MatrixClientPeg.get().getAccessToken()}>
|
||||||
<{ _t("click to reveal") }>
|
<{ _t("click to reveal") }>
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
|
|
Loading…
Reference in a new issue