mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +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
|
||||
title={i18next.t("user:MFA accounts")}
|
||||
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);}}
|
||||
/>
|
||||
</Col>
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import React from "react";
|
||||
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 i18next from "i18next";
|
||||
|
||||
@ -23,6 +23,8 @@ class MfaAccountTable extends React.Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
classes: props,
|
||||
qrUrl: this.props.qrUrl,
|
||||
icon: this.props.icon,
|
||||
mfaAccounts: this.props.table !== null ? this.props.table.map((item, index) => {
|
||||
item.key = index;
|
||||
return item;
|
||||
@ -158,6 +160,15 @@ class MfaAccountTable extends React.Component {
|
||||
<div>
|
||||
{this.props.title}
|
||||
<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>
|
||||
)}
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user