From 337f0df12ac4185e23352dc21fad32bda8b159fd Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 11 Nov 2018 22:27:43 -0800 Subject: [PATCH] First design of second factor page. --- client-react/src/App.tsx | 4 +- client-react/src/first-factor/index.tsx | 91 ---------------- .../first-factor/first-factor.module.css | 39 +++++++ .../src/pages/first-factor/first-factor.tsx | 83 ++++++++++++++ .../second-factor/second-factor.module.css | 37 +++++++ .../src/pages/second-factor/second-factor.tsx | 103 ++++++++++++++++++ client-react/src/pendrive.png | Bin 0 -> 6721 bytes client-react/src/second-factor/index.tsx | 7 -- .../form-template.module.css} | 39 +------ client-react/src/templates/form-template.tsx | 30 +++++ 10 files changed, 295 insertions(+), 138 deletions(-) delete mode 100644 client-react/src/first-factor/index.tsx create mode 100644 client-react/src/pages/first-factor/first-factor.module.css create mode 100644 client-react/src/pages/first-factor/first-factor.tsx create mode 100644 client-react/src/pages/second-factor/second-factor.module.css create mode 100644 client-react/src/pages/second-factor/second-factor.tsx create mode 100644 client-react/src/pendrive.png delete mode 100644 client-react/src/second-factor/index.tsx rename client-react/src/{first-factor/index.module.css => templates/form-template.module.css} (54%) create mode 100644 client-react/src/templates/form-template.tsx diff --git a/client-react/src/App.tsx b/client-react/src/App.tsx index 3ae8e141..51f9dbbc 100644 --- a/client-react/src/App.tsx +++ b/client-react/src/App.tsx @@ -2,8 +2,8 @@ import React, { Component } from 'react'; import './App.css'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; -import { FirstFactor } from './first-factor'; -import { SecondFactor } from './second-factor'; +import { FirstFactor } from './pages/first-factor/first-factor'; +import { SecondFactor } from './pages/second-factor/second-factor'; class App extends Component { render() { diff --git a/client-react/src/first-factor/index.tsx b/client-react/src/first-factor/index.tsx deleted file mode 100644 index 24005a82..00000000 --- a/client-react/src/first-factor/index.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import React, { Component } from "react"; - -import TextField from '@material-ui/core/TextField'; -import Button from '@material-ui/core/Button'; - -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import Checkbox from '@material-ui/core/Checkbox'; - -import logo from '../logo.svg'; -import styles from "./index.module.css" - -interface State { - rememberMe: boolean; -} - -export class FirstFactor extends Component { - constructor(props: any) { - super(props) - this.state = { - rememberMe: false - } - } - - toggleRememberMe = () => { - this.setState({ - rememberMe: !(this.state.rememberMe) - }) - } - - render() { - return ( -
-
-

Sign in

-
-
-
-
-
- - -
-
- - -
-
-
-
-
- - } - label="Remember me" - /> -
- -
-
- -
-
-
-
-
- logo -
Powered by Authelia
-
-
- ) - } -} \ No newline at end of file diff --git a/client-react/src/pages/first-factor/first-factor.module.css b/client-react/src/pages/first-factor/first-factor.module.css new file mode 100644 index 00000000..ea6e40bb --- /dev/null +++ b/client-react/src/pages/first-factor/first-factor.module.css @@ -0,0 +1,39 @@ +.main { + padding: 2em 3em 2em 3em; +} + +.field { + width: 100%; + margin-bottom: 20px; +} + +.field .input { + width: 100%; +} + +.controls { + display: inline-block; + width: 100%; + font-size: 0.875rem; +} + +.controls .rememberMe { + float: left; +} + +.controls .resetPassword { + padding: 12px 0px; + float: right; +} + +.controls .resetPassword a { + color: black; +} + +.buttons { + margin-top: 20px; +} + +.buttons button { + width: 100%; +} \ No newline at end of file diff --git a/client-react/src/pages/first-factor/first-factor.tsx b/client-react/src/pages/first-factor/first-factor.tsx new file mode 100644 index 00000000..1f91e842 --- /dev/null +++ b/client-react/src/pages/first-factor/first-factor.tsx @@ -0,0 +1,83 @@ +import React, { Component } from "react"; + +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; + +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import Checkbox from '@material-ui/core/Checkbox'; + +import FormTemplate from '../../templates/form-template'; + +import styles from "./first-factor.module.css" + +interface State { + rememberMe: boolean; +} + +export class FirstFactor extends Component { + constructor(props: any) { + super(props) + this.state = { + rememberMe: false + } + } + + toggleRememberMe = () => { + this.setState({ + rememberMe: !(this.state.rememberMe) + }) + } + + render() { + return ( + +
+
+
+ + +
+
+ + +
+
+
+
+
+ + } + label="Remember me" + /> +
+ +
+
+ +
+
+
+
+ ) + } +} \ No newline at end of file diff --git a/client-react/src/pages/second-factor/second-factor.module.css b/client-react/src/pages/second-factor/second-factor.module.css new file mode 100644 index 00000000..4568c8ea --- /dev/null +++ b/client-react/src/pages/second-factor/second-factor.module.css @@ -0,0 +1,37 @@ +.main { + text-align: center; + padding: 2em 3em 2em 3em; + min-height: 350px; +} + +.authenticate { + margin: 1em; +} + +.authenticate hr { + width: 100%; +} + +.authenticate .u2f img { + width: 128px; + margin-top: 1em; +} + +.authenticate .totpField { + margin: 1em 0em; +} + + + +.register { + margin: 1em; +} + +.register .buttons { + margin: 2em 0em; +} + +.register .buttons button { + margin: 0.8em 0em; + width: 100%; +} \ No newline at end of file diff --git a/client-react/src/pages/second-factor/second-factor.tsx b/client-react/src/pages/second-factor/second-factor.tsx new file mode 100644 index 00000000..93608958 --- /dev/null +++ b/client-react/src/pages/second-factor/second-factor.tsx @@ -0,0 +1,103 @@ +import React, { Component } from "react"; + +import TextField from '@material-ui/core/TextField'; + +import BottomNavigation from '@material-ui/core/BottomNavigation'; +import BottomNavigationAction from '@material-ui/core/BottomNavigationAction'; +import RestoreIcon from '@material-ui/core/Icon'; +import FavoriteIcon from '@material-ui/core/Icon'; +import Button from '@material-ui/core/Button'; + +import FormTemplate from '../../templates/form-template'; + +import styles from './second-factor.module.css'; +import pendrive from '../../pendrive.png' + +interface State { + mode: number; +} + +export class SecondFactor extends Component { + constructor(props: any) { + super(props); + this.state = { + mode: 0 + } + } + + onMenuChanged(event: any, value: number) { + this.setState({mode: value}); + } + + renderInner() { + const registerDevice = ( +
+
Register a new device
+
+ + +
+
+ ) + + const authenticate = ( +
+
+ Touch your security key +
+ usb key +
+
+ + + + + + + + +

or
+
+ Provide a one-time password +
+ + +
+
+
+ ) + + if (this.state.mode == 0) { + return authenticate; + } + else if (this.state.mode == 1) { + return registerDevice; + } + } + + render() { + return ( + +
+ {this.renderInner()} +
+ + } /> + } /> + +
+ ) + } +} \ No newline at end of file diff --git a/client-react/src/pendrive.png b/client-react/src/pendrive.png new file mode 100644 index 0000000000000000000000000000000000000000..fa49178c326631167ec642aaacc117c38b31f6bf GIT binary patch literal 6721 zcmYj0cRbba_va4owYNlZGooSNP}U_QA;hPFjO=I_A@eN_J7wjPk;R>;VR z$X=mHWZd7o&-e4k@4jC5^*qlx=Q+gJU`;0Wjzk14Kr2 zu=aZFj1G8jZ37D;`U@gDMxbk^E62`y1F$Uo{bPtXm}F7lP9NPfKIWI5ef;dboWRe| zPsZ(%ySIb=6(^a?UM^`1YJw^rtlsTWbmwuD!;DB%b?}U>BPr*-HV6K#5krRGRm-9 z$5_1ZA<|iRr?ly@qMTxS>fxa+^Is{+QLIMv;nu^Cs@f0Sh(FC4!V~br!kfBEZX+*{ zHOSF!r@C}H-*t$0jdvz?rRP)_dEd^zHNn17;yph+{<1yNp8ny&YUrP$!f&m$&faQ- zAc7`7BkRo?vc6c z0<-nnd#{u&*2GL*ml!r6UHJCpQ)_R~1i&ocb>33(%f-Sy%Dq-rJL0 z%@@6di!&emRP?wh&j9{X!HRK`*zEHZLr1WJJNeDrs=LCzEX`f>yHz_vejtT^zF*1RtrrIo!F_j4Ef`}>UWp5OND z%&DkR;*N>KSKkW|;8xV4j<=vLmqxSq{0(^y$l#;1`Hm7N;tw=?Z!xr_Q!{J!c!R9kXI2heg$7akcGqZIWikBl#xb5=fi-~bD7xU63(VmHW@61}0@z^5Y`d16 zBInALloRu$7ARjPII^BJ*y$eRb@E^U_|8YaN@Zm=eRtgK{lFYhgeJ;9oU)FHE!|r} zfYO>$5hL^4^$~qiS3OvjaPV20UZB!)$8~;xeF4w{l$#E|&pJv@J}-PZs(Gw)=s2sA zPR^6@i;?ms6N?dZ8$`)vh9g+G+ASBjX`4Z01G@W`zM9BtUsz|_0Ybmz_%Bg z=-&eGg^sBfIJf^!QW$D$Wdic^O&KzW)3u4U$=<+sR1wX=N`n_e<(GQW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@BqOYLNmZZW!B<-)6sGImFezP><92Yn2CI-1)K;ZmjLG8=?Q(29>xdhRO zI89X`A@}bcu88ytKQY0|S0nNUm!;@J3!juEA>>jk+2Ec#qw512AjhgDBskIZoPdqU zP+hTpII$>hE}4s^5U{FLMGDv-Seu>X7ni{jkOeEWJjs6DjOc3*_7h9HbqPLknhlngQJ`( zU5QxCx4p}o3U%`ln(tLWj{kZ+xq^Z$wl>BUPap7J)kS@R>X(CT!*`VYVjv zWIH}tg9jL^D!TOP|+c&KR|ifYSVbz>1=5IeJrRsbi_F;8LNFXCfQvvi+lO~bKPXh?#Q(@ zk0x7rUqBv{e4MNJ_I*hnO5(#z_=ik>T2sxqc6)h>FTXtMRsUY}J9I((E-q>({gFu%7jo0_>I8H0YfRO8S#q;8YL$e+j(RPv7q;Gw3T&=i! zpzd(R`zonJfnR@gi~qS$dw6NQxMI&EmZT@2RGg>O=p0T9x)1t)$FZZ`3K-~~(0QS4 Hcm4kWRQYbi literal 0 HcmV?d00001 diff --git a/client-react/src/second-factor/index.tsx b/client-react/src/second-factor/index.tsx deleted file mode 100644 index 01271f2b..00000000 --- a/client-react/src/second-factor/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React, { Component } from "react"; - -export class SecondFactor extends Component { - render() { - return
second factor
- } -} \ No newline at end of file diff --git a/client-react/src/first-factor/index.module.css b/client-react/src/templates/form-template.module.css similarity index 54% rename from client-react/src/first-factor/index.module.css rename to client-react/src/templates/form-template.module.css index 22a85274..977874e9 100644 --- a/client-react/src/first-factor/index.module.css +++ b/client-react/src/templates/form-template.module.css @@ -12,55 +12,18 @@ text-align: center; } -/* MAIN */ +/* FRAME */ .frame { box-shadow: rgba(0,0,0,0.14902) 0px 1px 1px 0px,rgba(0,0,0,0.09804) 0px 1px 2px 0px; background-color: white; border-radius: 5px; - padding: 0.5em 3em 3em 3em; } .innerFrame { width: 100%; } -.field { - width: 100%; - margin: 20px 0px; -} - -.field .input { - width: 100%; -} - -.controls { - display: inline-block; - width: 100%; - font-size: 0.875rem; -} - -.controls .rememberMe { - float: left; -} - -.controls .resetPassword { - padding: 12px 0px; - float: right; -} - -.controls .resetPassword a { - color: black; -} - -.buttons { - margin-top: 20px; -} - -.buttons button { - width: 100%; -} - /* FOOTER */ .footer { diff --git a/client-react/src/templates/form-template.tsx b/client-react/src/templates/form-template.tsx new file mode 100644 index 00000000..f5890d8f --- /dev/null +++ b/client-react/src/templates/form-template.tsx @@ -0,0 +1,30 @@ +import React, { Component } from "react"; + +import logo from '../logo.svg'; +import styles from "./form-template.module.css" + +interface Props { + title: string; +} + +export default class FormTemplate extends Component { + render() { + const children = this.props.children; + return ( +
+
+

{this.props.title}

+
+
+
+ {children} +
+
+
+ logo +
Powered by Authelia
+
+
+ ) + } +} \ No newline at end of file