From 0f483fb65b35c65f120b7f25e64252d812bd8b67 Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Thu, 16 Jun 2022 22:00:34 +0800 Subject: [PATCH] Improve preview buttons to copy link. --- web/src/ApplicationEditPage.js | 100 +++++++++++++-------------------- web/src/ProductEditPage.js | 2 +- web/src/basic/HomePage.js | 2 +- web/src/locales/de/data.json | 9 ++- web/src/locales/en/data.json | 9 ++- web/src/locales/fr/data.json | 9 ++- web/src/locales/ja/data.json | 9 ++- web/src/locales/ko/data.json | 9 ++- web/src/locales/ru/data.json | 9 ++- web/src/locales/zh/data.json | 13 +++-- 10 files changed, 86 insertions(+), 85 deletions(-) diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index 1cce04fa..361011d4 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -14,7 +14,7 @@ import React from "react"; import {Button, Card, Col, Input, Popover, Row, Select, Switch, Upload} from 'antd'; -import {LinkOutlined, UploadOutlined} from "@ant-design/icons"; +import {CopyOutlined, LinkOutlined, UploadOutlined} from "@ant-design/icons"; import * as ApplicationBackend from "./backend/ApplicationBackend"; import * as CertBackend from "./backend/CertBackend"; import * as Setting from "./Setting"; @@ -28,6 +28,7 @@ import UrlTable from "./UrlTable"; import ProviderTable from "./ProviderTable"; import SignupTable from "./SignupTable"; import PromptPage from "./auth/PromptPage"; +import copy from "copy-to-clipboard"; import {Controlled as CodeMirror} from 'react-codemirror2'; import "codemirror/lib/codemirror.css"; @@ -180,7 +181,7 @@ class ApplicationEditPage extends React.Component { {Setting.getLabel(i18next.t("general:Logo"), i18next.t("general:Logo - Tooltip"))} : - + {Setting.getLabel(i18next.t("general:URL"), i18next.t("general:URL - Tooltip"))} : @@ -500,7 +501,7 @@ class ApplicationEditPage extends React.Component { {Setting.getLabel(i18next.t("general:Preview"), i18next.t("general:Preview - Tooltip"))} : { - this.renderPreview() + this.renderSignupSigninPreview() } { @@ -524,30 +525,33 @@ class ApplicationEditPage extends React.Component { {Setting.getLabel(i18next.t("general:Preview"), i18next.t("general:Preview - Tooltip"))} : { - this.renderPreview2() + this.renderPromptPreview() } ) } - renderPreview() { + renderSignupSigninPreview() { let signUpUrl = `/signup/${this.state.application.name}`; let signInUrl = `/login/oauth/authorize?client_id=${this.state.application.clientId}&response_type=code&redirect_uri=${this.state.application.redirectUris[0]}&scope=read&state=casdoor`; let maskStyle = {position: 'absolute', top: '0px', left: '0px', zIndex: 10, height: '100%', width: '100%', background: 'rgba(0,0,0,0.4)'}; if (!this.state.application.enablePassword) { signUpUrl = signInUrl.replace("/login/oauth/authorize", "/signup/oauth/authorize"); } - if (!Setting.isMobile()) { + return ( - - - - + +
-
-
+
{ this.state.application.enablePassword ? ( @@ -558,40 +562,16 @@ class ApplicationEditPage extends React.Component {
- - - - + +
-
-
- -
-
- - - ) - } else{ - return( - - - - - -
- { - this.state.application.enablePassword ? ( - - ) : ( - - ) - } -
-
- - - -
+
@@ -599,25 +579,25 @@ class ApplicationEditPage extends React.Component { ) } -} - renderPreview2() { + renderPromptPreview() { let promptUrl = `/prompt/${this.state.application.name}`; let maskStyle = {position: 'absolute', top: '0px', left: '0px', zIndex: 10, height: '100%', width: '100%', background: 'rgba(0,0,0,0.4)'}; return ( - - - - - -
-
-
- -
-
- -
+ + +
+
+ +
+
+ ) } diff --git a/web/src/ProductEditPage.js b/web/src/ProductEditPage.js index 49d62e21..7818a08f 100644 --- a/web/src/ProductEditPage.js +++ b/web/src/ProductEditPage.js @@ -110,7 +110,7 @@ class ProductEditPage extends React.Component { {Setting.getLabel(i18next.t("product:Image"), i18next.t("product:Image - Tooltip"))} : - + {Setting.getLabel(i18next.t("general:URL"), i18next.t("general:URL - Tooltip"))} : diff --git a/web/src/basic/HomePage.js b/web/src/basic/HomePage.js index e7107ff9..a7a2036c 100644 --- a/web/src/basic/HomePage.js +++ b/web/src/basic/HomePage.js @@ -92,7 +92,7 @@ class HomePage extends React.Component { ) } else { return ( -
+
{ items.map(item => { diff --git a/web/src/locales/de/data.json b/web/src/locales/de/data.json index f7a32066..29a69602 100644 --- a/web/src/locales/de/data.json +++ b/web/src/locales/de/data.json @@ -6,6 +6,9 @@ "Sign Up": "Registrieren" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "Anwendung bearbeiten", "Enable code signin": "Code-Anmeldung aktivieren", "Enable code signin - Tooltip": "Aktiviere Codeanmeldung - Tooltip", @@ -19,6 +22,7 @@ "Password ON": "Passwort AN", "Password ON - Tooltip": "Whether to allow password login", "Please select a HTML file": "Bitte wählen Sie eine HTML-Datei", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "Weiterleitungs-URL", "Redirect URLs": "Umleitungs-URLs", "Redirect URLs - Tooltip": "List of redirect addresses after successful login", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Aktualisierungs-Token läuft ab - Tooltip", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "Anmeldesitzung", "Signup items": "Artikel registrieren", "Signup items - Tooltip": "Signup items that need to be filled in when users register", - "Test prompt page..": "Test-Nachfrageseite..", - "Test signin page..": "Anmeldeseite testen..", - "Test signup page..": "Anmeldeseite testen..", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "Token läuft ab", "Token expire - Tooltip": "Token läuft ab - Tooltip", "Token format": "Token-Format", diff --git a/web/src/locales/en/data.json b/web/src/locales/en/data.json index 79cec8f8..cf3f46d4 100644 --- a/web/src/locales/en/data.json +++ b/web/src/locales/en/data.json @@ -6,6 +6,9 @@ "Sign Up": "Sign Up" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "Edit Application", "Enable code signin": "Enable code signin", "Enable code signin - Tooltip": "Enable code signin - Tooltip", @@ -19,6 +22,7 @@ "Password ON": "Password ON", "Password ON - Tooltip": "Password ON - Tooltip", "Please select a HTML file": "Please select a HTML file", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "Redirect URL", "Redirect URLs": "Redirect URLs", "Redirect URLs - Tooltip": "Redirect URLs - Tooltip", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Refresh token expire - Tooltip", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "Signin session", "Signup items": "Signup items", "Signup items - Tooltip": "Signup items - Tooltip", - "Test prompt page..": "Test prompt page..", - "Test signin page..": "Test signin page..", - "Test signup page..": "Test signup page..", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "Token expire", "Token expire - Tooltip": "Token expire - Tooltip", "Token format": "Token format", diff --git a/web/src/locales/fr/data.json b/web/src/locales/fr/data.json index e08008ba..e60dd433 100644 --- a/web/src/locales/fr/data.json +++ b/web/src/locales/fr/data.json @@ -6,6 +6,9 @@ "Sign Up": "S'inscrire" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "Modifier l'application", "Enable code signin": "Activer la connexion au code", "Enable code signin - Tooltip": "Activer la connexion au code - infobulle", @@ -19,6 +22,7 @@ "Password ON": "Mot de passe activé", "Password ON - Tooltip": "Whether to allow password login", "Please select a HTML file": "Veuillez sélectionner un fichier HTML", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "URL de redirection", "Redirect URLs": "URL de redirection", "Redirect URLs - Tooltip": "List of redirect addresses after successful login", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Expiration du jeton d'actualisation - infobulle", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "Connexion à la session", "Signup items": "Inscrire des éléments", "Signup items - Tooltip": "Signup items that need to be filled in when users register", - "Test prompt page..": "Tester la vitesse d'exécution.", - "Test signin page..": "Tester la connexion en ligne.", - "Test signup page..": "Tester l'inscription.", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "Expiration du jeton", "Token expire - Tooltip": "Expiration du jeton - Info-bulle", "Token format": "Format du jeton", diff --git a/web/src/locales/ja/data.json b/web/src/locales/ja/data.json index 5bb24b13..e564a686 100644 --- a/web/src/locales/ja/data.json +++ b/web/src/locales/ja/data.json @@ -6,6 +6,9 @@ "Sign Up": "新規登録" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "アプリケーションを編集", "Enable code signin": "コードサインインを有効にする", "Enable code signin - Tooltip": "Enable code signin - Tooltip", @@ -19,6 +22,7 @@ "Password ON": "パスワードON", "Password ON - Tooltip": "Whether to allow password login", "Please select a HTML file": "HTMLファイルを選択してください", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "リダイレクトURL", "Redirect URLs": "リダイレクトURL", "Redirect URLs - Tooltip": "List of redirect addresses after successful login", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "トークンの有効期限を更新する - ツールチップ", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "サインインセッション", "Signup items": "アイテムの登録", "Signup items - Tooltip": "Signup items that need to be filled in when users register", - "Test prompt page..": "テストプロンプトページ...", - "Test signin page..": "サインインテストページ...", - "Test signup page..": "登録ページのテスト", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "トークンの有効期限", "Token expire - Tooltip": "トークンの有効期限 - ツールチップ", "Token format": "トークンのフォーマット", diff --git a/web/src/locales/ko/data.json b/web/src/locales/ko/data.json index eec3dd80..0cda9a67 100644 --- a/web/src/locales/ko/data.json +++ b/web/src/locales/ko/data.json @@ -6,6 +6,9 @@ "Sign Up": "Sign Up" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "Edit Application", "Enable code signin": "Enable code signin", "Enable code signin - Tooltip": "Enable code signin - Tooltip", @@ -19,6 +22,7 @@ "Password ON": "Password ON", "Password ON - Tooltip": "Whether to allow password login", "Please select a HTML file": "Please select a HTML file", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "Redirect URL", "Redirect URLs": "Redirect URLs", "Redirect URLs - Tooltip": "List of redirect addresses after successful login", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Refresh token expire - Tooltip", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "Signin session", "Signup items": "Signup items", "Signup items - Tooltip": "Signup items that need to be filled in when users register", - "Test prompt page..": "Test prompt page..", - "Test signin page..": "Test signin page..", - "Test signup page..": "Test signup page..", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "Token expire", "Token expire - Tooltip": "Token expire - Tooltip", "Token format": "Token format", diff --git a/web/src/locales/ru/data.json b/web/src/locales/ru/data.json index 1f93f8e7..65b6db21 100644 --- a/web/src/locales/ru/data.json +++ b/web/src/locales/ru/data.json @@ -6,6 +6,9 @@ "Sign Up": "Регистрация" }, "application": { + "Copy prompt page URL": "Copy prompt page URL", + "Copy signin page URL": "Copy signin page URL", + "Copy signup page URL": "Copy signup page URL", "Edit Application": "Изменить приложение", "Enable code signin": "Включить кодовый вход", "Enable code signin - Tooltip": "Включить вход с кодом - Tooltip", @@ -19,6 +22,7 @@ "Password ON": "Пароль ВКЛ", "Password ON - Tooltip": "Whether to allow password login", "Please select a HTML file": "Пожалуйста, выберите HTML-файл", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Redirect URL": "URL перенаправления", "Redirect URLs": "Перенаправление URL", "Redirect URLs - Tooltip": "List of redirect addresses after successful login", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Срок обновления токена истекает - Подсказка", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Signin session": "Сессия входа", "Signup items": "Элементы регистрации", "Signup items - Tooltip": "Signup items that need to be filled in when users register", - "Test prompt page..": "Тестовая страница запроса..", - "Test signin page..": "Тестовая страница входа..", - "Test signup page..": "Тестовая страница регистрации..", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser", "Token expire": "Токен истекает", "Token expire - Tooltip": "Истек токен - Подсказка", "Token format": "Формат токена", diff --git a/web/src/locales/zh/data.json b/web/src/locales/zh/data.json index 6ae6f49e..1b840f47 100644 --- a/web/src/locales/zh/data.json +++ b/web/src/locales/zh/data.json @@ -6,6 +6,9 @@ "Sign Up": "注册" }, "application": { + "Copy prompt page URL": "复制提醒页面URL", + "Copy signin page URL": "复制登录页面URL", + "Copy signup page URL": "复制注册页面URL", "Edit Application": "编辑应用", "Enable code signin": "启用验证码登录", "Enable code signin - Tooltip": "是否允许用手机或邮箱验证码登录", @@ -19,6 +22,7 @@ "Password ON": "开启密码", "Password ON - Tooltip": "是否允许密码登录", "Please select a HTML file": "请选择一个HTML文件", + "Prompt page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "提醒页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问", "Redirect URL": "重定向 URL", "Redirect URLs": "重定向 URLs", "Redirect URLs - Tooltip": "登录成功后重定向地址列表", @@ -26,12 +30,11 @@ "Refresh token expire - Tooltip": "Refresh Token过期时间", "SAML metadata": "SAML元数据", "SAML metadata - Tooltip": "SAML协议的元数据(Metadata)信息", + "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "登录页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问", "Signin session": "保持登录会话", "Signup items": "注册项", "Signup items - Tooltip": "注册用户注册时需要填写的项目", - "Test prompt page..": "测试提醒页面..", - "Test signin page..": "测试登录页面..", - "Test signup page..": "测试注册页面..", + "Signup page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "注册页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问", "Token expire": "Access Token过期", "Token expire - Tooltip": "Access Token过期时间", "Token format": "Access Token格式", @@ -411,7 +414,7 @@ "IdP public key": "IdP 公钥", "Issuer URL": "发行者网址", "Issuer URL - Tooltip": "发行者URL - 工具提示", - "Link copied to clipboard successfully": "链接复制到剪贴板成功", + "Link copied to clipboard successfully": "链接已成功复制到剪贴板", "Metadata": "元数据", "Metadata - Tooltip": "元数据 - 工具提示", "Method": "方法", @@ -464,7 +467,7 @@ "canSignIn": "可用于登录", "canSignUp": "可用于注册", "canUnlink": "可解绑定", - "prompted": "注册后提示绑定", + "prompted": "注册后提醒绑定", "required": "是否必填项", "rule": "规则", "visible": "是否可见"