diff --git a/object/application.go b/object/application.go index 05aa2e1f..243b0a97 100644 --- a/object/application.go +++ b/object/application.go @@ -70,6 +70,7 @@ type Application struct { SigninHtml string `xorm:"mediumtext" json:"signinHtml"` FormCss string `xorm:"text" json:"formCss"` FormOffset int `json:"formOffset"` + FormSideHtml string `xorm:"mediumtext" json:"formSideHtml"` FormBackgroundUrl string `xorm:"varchar(200)" json:"formBackgroundUrl"` } diff --git a/web/src/App.less b/web/src/App.less index b83cf554..a14c39d2 100644 --- a/web/src/App.less +++ b/web/src/App.less @@ -94,6 +94,37 @@ align-items: stretch; } +.side-image { + display: none; + @media screen and (min-width: 1100px){ + display: block; + position: relative; + width: 500px; + border-right: 0.5px solid rgb(196, 203, 215); + } +} + +.forget-content{ + padding: 10px 100px 20px; + border: 2px solid #ffffff; + border-radius: 7px; + background-color: rgb(255, 255, 255); + box-shadow: 0 0 20px rgba(0, 0, 0, 0.20); +} + +.login-panel{ + margin-top: 50px; + margin-bottom: 50px; + display: flex; + background-color: rgb(255, 255, 255); + overflow: hidden; +} + +.login-form{ + text-align: center; + padding: 30px; +} + .login-content { display: flex; flex-direction: row; @@ -105,7 +136,9 @@ } .loginBackground { - height: 100%; + display: flex; + align-items: center; + flex: 1 1 0; background: #fff no-repeat; background-size: 100% 100%; background-attachment: fixed; diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index 1ce6f8ee..fd5c7f94 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -32,6 +32,7 @@ import copy from "copy-to-clipboard"; import {Controlled as CodeMirror} from "react-codemirror2"; import "codemirror/lib/codemirror.css"; + require("codemirror/theme/material-darker.css"); require("codemirror/mode/htmlmixed/htmlmixed"); require("codemirror/mode/xml/xml"); @@ -39,13 +40,52 @@ require("codemirror/mode/css/css"); const {Option} = Select; -const template = { - padding: "30px", - border: "2px solid #ffffff", - borderRadius: "7px", - backgroundColor: "#ffffff", - boxShadow: " 0px 0px 20px rgba(0, 0, 0, 0.20)", -}; +const template = ` + +`; +const sideTemplate = ` + +
+ +
+ Casdoor +
+
+`; class ApplicationEditPage extends React.Component { constructor(props) { @@ -157,7 +197,6 @@ class ApplicationEditPage extends React.Component { } renderApplication() { - const preview = JSON.stringify(template, null, 2); return ( @@ -562,10 +601,10 @@ class ApplicationEditPage extends React.Component { - + {Setting.getLabel(i18next.t("general:URL"), i18next.t("general:URL - Tooltip"))} : - + } value={this.state.application.formBackgroundUrl} onChange={e => { this.updateApplicationField("formBackgroundUrl", e.target.value); }} /> @@ -590,8 +629,8 @@ class ApplicationEditPage extends React.Component { - { this.updateApplicationField("formCss", value); }} @@ -609,11 +648,39 @@ class ApplicationEditPage extends React.Component { {Setting.getLabel(i18next.t("application:From position"), i18next.t("application:From position - Tooltip"))} : - {this.updateApplicationField("formOffset", e.target.value);}} value={this.state.application.formOffset !== 0 ? this.state.application.formOffset : 8}> - left - center - right - + + {this.updateApplicationField("formOffset", e.target.value);}} value={this.state.application.formOffset}> + {i18next.t("application:Left")} + {i18next.t("application:Center")} + {i18next.t("application:Right")} + + {i18next.t("application:Enable side panel")} + + + + {this.state.application.formOffset === 4 ? + + + {Setting.getLabel(i18next.t("application:Side panel HTML"), i18next.t("application:Side panel HTML - Tooltip"))} : + + + + { + this.updateApplicationField("formSideHtml", value); + }} + /> + + } title={i18next.t("application:Side panel HTML - Edit")} trigger="click"> + { + this.updateApplicationField("formSideHtml", e.target.value); + }} /> + + + + : null} { @@ -707,7 +774,7 @@ class ApplicationEditPage extends React.Component {
-
+
); diff --git a/web/src/auth/ForgetPage.js b/web/src/auth/ForgetPage.js index c2c42347..02129cc3 100644 --- a/web/src/auth/ForgetPage.js +++ b/web/src/auth/ForgetPage.js @@ -487,61 +487,65 @@ class ForgetPage extends React.Component { } return ( - - +
+ +
- -
- { - Setting.renderHelmet(application) - } - - { - Setting.renderLogo(application) - } + + + +
+ { + Setting.renderHelmet(application) + } + { + Setting.renderLogo(application) + } +
+ +
+ + +
+ {i18next.t("forget:Retrieve password")} +
+ +
+ + + + } + /> + } + /> + } + /> + + + + + +
+ {this.renderForm(application)}
- - -
- {i18next.t("forget:Retrieve password")} -
- -
- - - - } - /> - } - /> - } - /> - - - - - -
- {this.renderForm(application)} -
- - +
+
); } } diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index 7c172edb..04802d9e 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -139,6 +139,18 @@ class LoginPage extends React.Component { this.props.onUpdateAccount(account); } + parseOffset(offset) { + if (offset === 2 || offset === 4 || Setting.inIframe() || Setting.isMobile()) { + return "0 auto"; + } + if (offset === 1) { + return "0 10%"; + } + if (offset === 3) { + return "0 60%"; + } + } + populateOauthValues(values) { const oAuthParams = Util.getOAuthGetParameters(); if (oAuthParams !== null && oAuthParams.responseType !== null && oAuthParams.responseType !== "") { @@ -695,16 +707,18 @@ class LoginPage extends React.Component { ); } - const formStyle = Setting.inIframe() ? null : Setting.parseObject(application.formCss); - return (
- - -
-
- +
+ {Setting.inIframe() ? null :
} +
+ +
+
+
+
+
{ Setting.renderHelmet(application) @@ -724,8 +738,8 @@ class LoginPage extends React.Component {
- - +
+
); } diff --git a/web/src/auth/SignupPage.js b/web/src/auth/SignupPage.js index bb83050b..0e6b3a8e 100644 --- a/web/src/auth/SignupPage.js +++ b/web/src/auth/SignupPage.js @@ -14,7 +14,7 @@ import React from "react"; import {Link} from "react-router-dom"; -import {Button, Checkbox, Col, Form, Input, Modal, Result, Row} from "antd"; +import {Button, Checkbox, Form, Input, Modal, Result} from "antd"; import * as Setting from "../Setting"; import * as AuthBackend from "./AuthBackend"; import * as ProviderButton from "./ProviderButton"; @@ -148,6 +148,18 @@ class SignupPage extends React.Component { this.props.onUpdateAccount(account); } + parseOffset(offset) { + if (offset === 2 || offset === 4 || Setting.inIframe() || Setting.isMobile()) { + return "0 auto"; + } + if (offset === 1) { + return "0 10%"; + } + if (offset === 3) { + return "0 60%"; + } + } + onFinish(values) { const application = this.getApplicationObj(); values.phonePrefix = application.organizationObj.phonePrefix; @@ -615,17 +627,18 @@ class SignupPage extends React.Component { ); } - const formStyle = Setting.inIframe() ? null : Setting.parseObject(application.formCss); - return (
-   - - -
-
- +
+ {Setting.inIframe() ? null :
} +
+ +
+
+
+
+
{ Setting.renderHelmet(application) } @@ -637,8 +650,8 @@ class SignupPage extends React.Component { }
- - +
+
{ this.renderModal() } diff --git a/web/src/locales/de/data.json b/web/src/locales/de/data.json index 5594ed1b..e0ae9d17 100644 --- a/web/src/locales/de/data.json +++ b/web/src/locales/de/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Copy SAML metadata URL", "Copy prompt page URL": "Copy prompt page URL", "Copy signin page URL": "Copy signin page URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Enable WebAuthn signin - Tooltip", "Enable code signin": "Code-Anmeldung aktivieren", "Enable code signin - Tooltip": "Aktiviere Codeanmeldung - Tooltip", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Aktiviere Anmeldesession - Tooltip", "Enable signup": "Anmeldung aktivieren", "Enable signup - Tooltip": "Whether to allow users to sign up", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Grant types", "Grant types - Tooltip": "Grant types - Tooltip", + "Left": "Left", "New Application": "New Application", "Password ON": "Passwort AN", "Password ON - Tooltip": "Whether to allow password login", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "List of redirect addresses after successful login", "Refresh token expire": "Aktualisierungs-Token läuft ab", "Refresh token expire - Tooltip": "Aktualisierungs-Token läuft ab - Tooltip", + "Right": "Right", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", "SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - 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", diff --git a/web/src/locales/en/data.json b/web/src/locales/en/data.json index 856d5acc..c940481a 100644 --- a/web/src/locales/en/data.json +++ b/web/src/locales/en/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Copy SAML metadata URL", "Copy prompt page URL": "Copy prompt page URL", "Copy signin page URL": "Copy signin page URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Enable WebAuthn signin - Tooltip", "Enable code signin": "Enable code signin", "Enable code signin - Tooltip": "Enable code signin - Tooltip", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Enable signin session - Tooltip", "Enable signup": "Enable signup", "Enable signup - Tooltip": "Enable signup - Tooltip", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Grant types", "Grant types - Tooltip": "Grant types - Tooltip", + "Left": "Left", "New Application": "New Application", "Password ON": "Password ON", "Password ON - Tooltip": "Password ON - Tooltip", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "Redirect URLs - Tooltip", "Refresh token expire": "Refresh token expire", "Refresh token expire - Tooltip": "Refresh token expire - Tooltip", + "Right": "Right", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", "SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - 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", diff --git a/web/src/locales/fr/data.json b/web/src/locales/fr/data.json index 4961ed6f..75f8e41c 100644 --- a/web/src/locales/fr/data.json +++ b/web/src/locales/fr/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Copy SAML metadata URL", "Copy prompt page URL": "Copy prompt page URL", "Copy signin page URL": "Copy signin page URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Enable WebAuthn signin - Tooltip", "Enable code signin": "Activer la connexion au code", "Enable code signin - Tooltip": "Activer la connexion au code - infobulle", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Activer la session de connexion - infobulle", "Enable signup": "Activer l'inscription", "Enable signup - Tooltip": "Whether to allow users to sign up", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Grant types", "Grant types - Tooltip": "Grant types - Tooltip", + "Left": "Left", "New Application": "New Application", "Password ON": "Mot de passe activé", "Password ON - Tooltip": "Whether to allow password login", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "List of redirect addresses after successful login", "Refresh token expire": "Expiration du jeton d'actualisation", "Refresh token expire - Tooltip": "Expiration du jeton d'actualisation - infobulle", + "Right": "Right", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", "SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - 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", diff --git a/web/src/locales/ja/data.json b/web/src/locales/ja/data.json index 03339fe5..c206c3ac 100644 --- a/web/src/locales/ja/data.json +++ b/web/src/locales/ja/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Copy SAML metadata URL", "Copy prompt page URL": "Copy prompt page URL", "Copy signin page URL": "Copy signin page URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Enable WebAuthn signin - Tooltip", "Enable code signin": "コードサインインを有効にする", "Enable code signin - Tooltip": "Enable code signin - Tooltip", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Enable signin session - Tooltip", "Enable signup": "サインアップを有効にする", "Enable signup - Tooltip": "Whether to allow users to sign up", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Grant types", "Grant types - Tooltip": "Grant types - Tooltip", + "Left": "Left", "New Application": "New Application", "Password ON": "パスワードON", "Password ON - Tooltip": "Whether to allow password login", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "List of redirect addresses after successful login", "Refresh token expire": "トークンの更新の期限が切れます", "Refresh token expire - Tooltip": "トークンの有効期限を更新する - ツールチップ", + "Right": "Right", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", "SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - 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": "アイテムの登録", diff --git a/web/src/locales/ko/data.json b/web/src/locales/ko/data.json index f0d43e8d..50fa5f65 100644 --- a/web/src/locales/ko/data.json +++ b/web/src/locales/ko/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Copy SAML metadata URL", "Copy prompt page URL": "Copy prompt page URL", "Copy signin page URL": "Copy signin page URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Enable WebAuthn signin - Tooltip", "Enable code signin": "Enable code signin", "Enable code signin - Tooltip": "Enable code signin - Tooltip", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Enable signin session - Tooltip", "Enable signup": "Enable signup", "Enable signup - Tooltip": "Whether to allow users to sign up", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Grant types", "Grant types - Tooltip": "Grant types - Tooltip", + "Left": "Left", "New Application": "New Application", "Password ON": "Password ON", "Password ON - Tooltip": "Whether to allow password login", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "List of redirect addresses after successful login", "Refresh token expire": "Refresh token expire", "Refresh token expire - Tooltip": "Refresh token expire - Tooltip", + "Right": "Right", "SAML metadata": "SAML metadata", "SAML metadata - Tooltip": "SAML metadata - Tooltip", "SAML metadata URL copied to clipboard successfully": "SAML metadata URL copied to clipboard successfully", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - 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", diff --git a/web/src/locales/ru/data.json b/web/src/locales/ru/data.json index 369e1281..306579b7 100644 --- a/web/src/locales/ru/data.json +++ b/web/src/locales/ru/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "Auto signin - Tooltip", "Background URL": "Background URL", "Background URL - Tooltip": "Background URL - Tooltip", + "Center": "Center", "Copy SAML metadata URL": "Копировать адрес метаданных SAML", "Copy prompt page URL": "Скопировать URL-адрес страницы запроса", "Copy signin page URL": "Скопировать URL-адрес страницы входа", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "Включить вход с WebAuthn - Подсказка", "Enable code signin": "Включить кодовый вход", "Enable code signin - Tooltip": "Включить вход с кодом - Tooltip", + "Enable side panel": "Enable side panel", "Enable signin session - Tooltip": "Включить сеанс входа - Подсказка", "Enable signup": "Включить регистрацию", "Enable signup - Tooltip": "Whether to allow users to sign up", @@ -39,6 +41,7 @@ "From position - Tooltip": "From position - Tooltip", "Grant types": "Виды грантов", "Grant types - Tooltip": "Виды грантов - Подсказка", + "Left": "Left", "New Application": "Новое приложение", "Password ON": "Пароль ВКЛ", "Password ON - Tooltip": "Whether to allow password login", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "List of redirect addresses after successful login", "Refresh token expire": "Срок действия обновления токена истекает", "Refresh token expire - Tooltip": "Срок обновления токена истекает - Подсказка", + "Right": "Right", "SAML metadata": "Метаданные SAML", "SAML metadata - Tooltip": "Метаданные SAML - Подсказка", "SAML metadata URL copied to clipboard successfully": "Адрес метаданных SAML скопирован в буфер обмена", + "Side panel HTML": "Side panel HTML", + "Side panel HTML - Edit": "Side panel HTML - Edit", + "Side panel HTML - Tooltip": "Side panel HTML - Tooltip", "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "URL страницы входа успешно скопирован в буфер обмена, пожалуйста, вставьте его в окно инкогнито или другой браузер", "Signin session": "Сессия входа", "Signup items": "Элементы регистрации", diff --git a/web/src/locales/zh/data.json b/web/src/locales/zh/data.json index 0051d2fb..9ecb00fa 100644 --- a/web/src/locales/zh/data.json +++ b/web/src/locales/zh/data.json @@ -17,6 +17,7 @@ "Auto signin - Tooltip": "当Casdoor存在已登录会话时,自动采用该会话进行应用端的登录", "Background URL": "背景图URL", "Background URL - Tooltip": "登录页背景图的链接", + "Center": "居中", "Copy SAML metadata URL": "复制SAML元数据URL", "Copy prompt page URL": "复制提醒页面URL", "Copy signin page URL": "复制登录页面URL", @@ -28,6 +29,7 @@ "Enable WebAuthn signin - Tooltip": "是否支持用户在登录页面通过WebAuthn方式登录", "Enable code signin": "启用验证码登录", "Enable code signin - Tooltip": "是否允许用手机或邮箱验证码登录", + "Enable side panel": "启用侧面板", "Enable signin session - Tooltip": "从应用登录Casdoor后,Casdoor是否保持会话", "Enable signup": "启用注册", "Enable signup - Tooltip": "是否允许用户注册", @@ -39,6 +41,7 @@ "From position - Tooltip": "登录和注册面板的位置", "Grant types": "OAuth授权类型", "Grant types - Tooltip": "选择允许哪些OAuth协议中的Grant types", + "Left": "居左", "New Application": "添加应用", "Password ON": "开启密码", "Password ON - Tooltip": "是否允许密码登录", @@ -49,9 +52,13 @@ "Redirect URLs - Tooltip": "登录成功后重定向地址列表", "Refresh token expire": "Refresh Token过期", "Refresh token expire - Tooltip": "Refresh Token过期时间", + "Right": "居右", "SAML metadata": "SAML元数据", "SAML metadata - Tooltip": "SAML协议的元数据(Metadata)信息", "SAML metadata URL copied to clipboard successfully": "SAML元数据URL已成功复制到剪贴板", + "Side panel HTML": "侧面板 HTML", + "Side panel HTML - Edit": "侧面板 HTML - 编辑", + "Side panel HTML - Tooltip": "侧面板 HTML - Tooltip", "Signin page URL copied to clipboard successfully, please paste it into the incognito window or another browser": "登录页面URL已成功复制到剪贴板,请粘贴到当前浏览器的隐身模式窗口或另一个浏览器访问", "Signin session": "保持登录会话", "Signup items": "注册项",