mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
feat: support QR login for casdoor app (#3190)
* feat: add MFA devices QR code to UserEditPage * chore: remove mfa devices
This commit is contained in:
parent
0d02b5e768
commit
943edfb48b
@ -1050,6 +1050,13 @@ class UserEditPage extends React.Component {
|
|||||||
<MfaAccountTable
|
<MfaAccountTable
|
||||||
title={i18next.t("user:MFA accounts")}
|
title={i18next.t("user:MFA accounts")}
|
||||||
table={this.state.user.mfaAccounts}
|
table={this.state.user.mfaAccounts}
|
||||||
|
qrUrl={
|
||||||
|
"casdoor-app://login/into?serverUrl=" + window.location.origin +
|
||||||
|
"&clientId=" + this.state.application.clientId +
|
||||||
|
"&organizationName=" + this.state.organizationName +
|
||||||
|
"&appName=" + this.state.user.signupApplication
|
||||||
|
}
|
||||||
|
icon={this.state.user.avatar}
|
||||||
onUpdateTable={(table) => {this.updateUserField("mfaAccounts", table);}}
|
onUpdateTable={(table) => {this.updateUserField("mfaAccounts", table);}}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {DeleteOutlined, DownOutlined, UpOutlined} from "@ant-design/icons";
|
import {DeleteOutlined, DownOutlined, UpOutlined} from "@ant-design/icons";
|
||||||
import {Button, Col, Image, Input, Row, Table, Tooltip} from "antd";
|
import {Button, Col, Image, Input, Popover, QRCode, Row, Table, Tooltip} from "antd";
|
||||||
import * as Setting from "../Setting";
|
import * as Setting from "../Setting";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -23,6 +23,8 @@ class MfaAccountTable extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
classes: props,
|
classes: props,
|
||||||
|
qrUrl: this.props.qrUrl,
|
||||||
|
icon: this.props.icon,
|
||||||
mfaAccounts: this.props.table !== null ? this.props.table.map((item, index) => {
|
mfaAccounts: this.props.table !== null ? this.props.table.map((item, index) => {
|
||||||
item.key = index;
|
item.key = index;
|
||||||
return item;
|
return item;
|
||||||
@ -158,6 +160,15 @@ class MfaAccountTable extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
{this.props.title}
|
{this.props.title}
|
||||||
<Button style={{marginRight: "5px"}} type="primary" size="small" onClick={() => this.addRow(table)}>{i18next.t("general:Add")}</Button>
|
<Button style={{marginRight: "5px"}} type="primary" size="small" onClick={() => this.addRow(table)}>{i18next.t("general:Add")}</Button>
|
||||||
|
<Popover trigger="focus" content={
|
||||||
|
<QRCode
|
||||||
|
value={this.state.qrUrl}
|
||||||
|
icon={this.state.icon}
|
||||||
|
bordered={false}
|
||||||
|
/>
|
||||||
|
}>
|
||||||
|
<Button style={{marginLeft: "5px"}} type="primary" size="small">{i18next.t("general:QR Code")}</Button>
|
||||||
|
</Popover>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user