Skip to content

Commit

Permalink
feat: add logout-confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Jun 21, 2022
1 parent 3c8aeab commit e4c3e75
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 53 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"dependencies": {
"@emotion/react": "^11.7.0",
"@gouvfr/dsfr": "^1.5.0",
"keycloakify": "^5.4.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"keycloakify": "^5.4.7",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"tss-react": "^3.6.0"
},
"devDependencies": {
"@types/node": "^16.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react": "^17.0.1",
"@types/react-dom": "^17.0.1",
"react-scripts": "5.0.1",
"typescript": "^4.1.2"
},
Expand Down
7 changes: 4 additions & 3 deletions src/KcApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { memo } from "react";
import type { KcContext } from "./kcContext";
import { KcApp as KcAppBase, defaultKcProps } from "keycloakify";
import { Login } from "./Login";
//import { LogoutConfirm } from "./LogoutConfirm";
import { LogoutConfirm } from "./LogoutConfirm";
import { Register } from "./Register";
import { makeStyles } from "makeStyles";

Expand All @@ -24,11 +24,12 @@ export const KcApp = memo((props: Props) => {
classes.kcFormCardClass,
],
};

switch (kcContext.pageId) {
case "login.ftl":
return <Login {...{ kcContext, ...kcProps }} />;
// case "logout-confirm.ftl":
case "logout-confirm.ftl":
return <LogoutConfirm {...{ kcContext, ...kcProps }} />;

// return <LogoutConfirm {...{ kcContext, ...kcProps }} />;
case "register.ftl":
return <Register {...{ kcContext, ...kcProps }} />;
Expand Down
1 change: 0 additions & 1 deletion src/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState, memo } from "react";
import { useConstCallback } from "powerhooks/useConstCallback";
import type { FormEventHandler } from "react";
import { KcContextBase, KcProps, getMsg } from "keycloakify";
import { useCssAndCx } from "tss-react";
import { Template } from "./Template";

export const Login = memo(
Expand Down
24 changes: 9 additions & 15 deletions src/LogoutConfirm.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { useState, memo } from "react";
import { useConstCallback } from "powerhooks/useConstCallback";
import type { FormEventHandler } from "react";
import { memo } from "react";
import { getMsg, KcContextBase, KcProps } from "keycloakify";
import { useCssAndCx } from "tss-react";
import { Template } from "./Template";

export const Login = memo(
export const LogoutConfirm = memo(
({
kcContext,
...props
Expand Down Expand Up @@ -44,25 +42,21 @@ export const Login = memo(
id="kc-form-buttons"
className={cx(props.kcFormGroupClass)}
>
<input
<button
tabIndex={4}
className={cx(
props.kcButtonClass,
props.kcButtonPrimaryClass,
props.kcButtonBlockClass,
props.kcButtonLargeClass
)}
type="submit"
className="fr-btn fr-btn--lg"
name="confirmLogout"
id="kc-logout"
type="submit"
value={msgStr("doLogout")}
/>
>
{msgStr("doLogout")}
</button>
</div>
</div>
</form>
<div id="kc-info-message">
{!logoutConfirm.skipLink && client.baseUrl && (
<p>
<p style={{ marginTop: 20 }}>
<a
href={client.baseUrl}
dangerouslySetInnerHTML={{
Expand Down
4 changes: 2 additions & 2 deletions src/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { ReactNode } from "react";
import { useConstCallback } from "powerhooks/useConstCallback";
import { useCssAndCx } from "tss-react";
import { KcContextBase, KcTemplateProps, getMsg } from "keycloakify";
import { pathJoin } from "keycloakify/dist/lib/tools/pathJoin";
import { headInsert } from "keycloakify/dist/lib/tools/headInsert";
import { pathJoin } from "keycloakify/lib/tools/pathJoin";
import { headInsert } from "keycloakify/lib/tools/headInsert";

export type TemplateProps = {
displayInfo?: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/kcContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const { kcContext } = getKcContext({
},
{
pageId: "logout-confirm.ftl",
locale: { currentLanguageTag: "fr" },
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion src/makeStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createMakeAndWithStyles } from "tss-react";
export const { makeStyles, useStyles } = createMakeAndWithStyles({
useTheme: () => ({
colors: {
background: "#1b1b35",
background: "#fff",
},
}),
});
55 changes: 29 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1823,17 +1823,17 @@
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
integrity sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==

"@types/react-dom@^18.0.0":
version "18.0.3"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.3.tgz#a022ea08c75a476fe5e96b675c3e673363853831"
integrity sha512-1RRW9kst+67gveJRYPxGmVy8eVJ05O43hg77G2j5m76/RFJtMbcfAs2viQ2UNsvvDg8F7OfQZx8qQcl6ymygaQ==
"@types/react-dom@^17.0.1":
version "17.0.17"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.17.tgz#2e3743277a793a96a99f1bf87614598289da68a1"
integrity sha512-VjnqEmqGnasQKV0CWLevqMTXBYG9GbwuE6x3VetERLh0cq2LTptFE73MrQi2S7GkKXCf2GgwItB/melLnxfnsg==
dependencies:
"@types/react" "*"
"@types/react" "^17"

"@types/react@*", "@types/react@^18.0.0":
version "18.0.8"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.8.tgz#a051eb380a9fbcaa404550543c58e1cf5ce4ab87"
integrity sha512-+j2hk9BzCOrrOSJASi5XiOyBbERk9jG5O73Ya4M0env5Ixi6vUNli4qy994AINcEF+1IEHISYFfIT4zwr++LKw==
"@types/react@^17", "@types/react@^17.0.1":
version "17.0.47"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.47.tgz#4ee71aaf4c5a9e290e03aa4d0d313c5d666b3b78"
integrity sha512-mk0BL8zBinf2ozNr3qPnlu1oyVTYq+4V7WA76RgxUAtf0Em/Wbid38KN6n4abEkvO4xMTBWmnP1FtQzgkEiJoA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
Expand Down Expand Up @@ -5725,10 +5725,10 @@ jsonpointer@^5.0.0:
array-includes "^3.1.3"
object.assign "^4.1.2"

keycloakify@^5.4.4:
version "5.4.6"
resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-5.4.6.tgz#6982c003cb7a3b5fdf3768119e5f63639e1b4cab"
integrity sha512-YLNWwbpQRrh6lo/21fQ5Y0DbEgRuxfU90Px6mGx+k++6+VbA4zCSUCgd1pVORsqp1utiMOueVR8EjswV7vrk8Q==
keycloakify@^5.4.7:
version "5.4.7"
resolved "https://registry.yarnpkg.com/keycloakify/-/keycloakify-5.4.7.tgz#9d4f6435c12f02883abfe4c3980bdda5897042a1"
integrity sha512-yZyPMWvVD2/7aHFf+YzmJzbp4E2hSfQaTnUfFByRSb3JNAZu8BxRRsq7n+OpX0VKbkSuiN/v5ktSY+x+O7jyfg==
dependencies:
"@octokit/rest" "^18.12.0"
cheerio "^1.0.0-rc.5"
Expand Down Expand Up @@ -7333,13 +7333,14 @@ react-dev-utils@^12.0.1:
strip-ansi "^6.0.1"
text-table "^0.2.0"

react-dom@^18.0.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.1.0.tgz#7f6dd84b706408adde05e1df575b3a024d7e8a2f"
integrity sha512-fU1Txz7Budmvamp7bshe4Zi32d0ll7ect+ccxNu9FlObT605GOEB8BfO4tmRJ39R5Zj831VCpvQ05QPBW5yb+w==
react-dom@^17.0.1:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
dependencies:
loose-envify "^1.1.0"
scheduler "^0.22.0"
object-assign "^4.1.1"
scheduler "^0.20.2"

react-error-overlay@^6.0.11:
version "6.0.11"
Expand Down Expand Up @@ -7432,12 +7433,13 @@ react-scripts@5.0.1:
optionalDependencies:
fsevents "^2.3.2"

react@^18.0.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
react@^17.0.1:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

readable-stream@^2.0.1:
version "2.3.7"
Expand Down Expand Up @@ -7721,12 +7723,13 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"

scheduler@^0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.22.0.tgz#83a5d63594edf074add9a7198b1bae76c3db01b8"
integrity sha512-6QAm1BgQI88NPYymgGQLCZgvep4FyePDWFpXVK+zNSUgHwlqpJy8VEh8Et0KxTACS4VWwMousBElAZOH9nkkoQ==
scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

schema-utils@2.7.0:
version "2.7.0"
Expand Down

0 comments on commit e4c3e75

Please sign in to comment.