@@ -35,8 +35,9 @@ class Full extends Component {
35
35
'drivemotors.auth0.com' , {
36
36
theme :{
37
37
logo : 'https://www.drivemotors.com/assets/logos/drive_logo_march_14.svg'
38
- }
39
-
38
+ } ,
39
+ allowSignUp : false ,
40
+ allowedConnections : [ 'Username-Password-Authentication' ]
40
41
}
41
42
) ;
42
43
this . lock . on ( "authenticated" , function ( authResult ) {
@@ -51,6 +52,7 @@ class Full extends Component {
51
52
return ;
52
53
}
53
54
console . log ( authResult ) ;
55
+ console . log ( profile ) ;
54
56
localStorage . setItem ( 'accessToken' , authResult . accessToken ) ;
55
57
localStorage . setItem ( 'profile' , JSON . stringify ( profile ) ) ;
56
58
@@ -69,63 +71,64 @@ class Full extends Component {
69
71
const { isAuthenticated } = this . props . auth ;
70
72
console . log ( 'render' ) ;
71
73
console . log ( this . props . auth . isAuthenticated ( ) ) ;
72
- return ( < div className = "container" >
73
- {
74
- isAuthenticated ( ) && (
75
- < div className = "app" >
76
- < AppHeader fixed >
77
- < FullHeader auth = { this . props . auth } />
78
- </ AppHeader >
79
- < div className = "app-body" >
80
- < AppSidebar fixed display = "lg" >
81
- < AppSidebarHeader />
82
- < AppSidebarForm />
83
- < AppSidebarNav navConfig = { navigation } { ...this . props } />
84
- < AppSidebarFooter />
85
- < AppSidebarMinimizer />
86
- </ AppSidebar >
87
- < main className = "main" >
88
- < AppBreadcrumb appRoutes = { routes } />
89
- < Container fluid >
90
- < Switch >
91
- { routes . map ( ( route , idx ) => {
92
- return route . component ? ( < Route key = { idx } path = { route . path } exact = { route . exact } name = { route . name } render = { props => (
93
- < route . component { ...props } />
94
- ) } /> )
95
- : ( null ) ;
96
- } ,
97
- ) }
98
- < Redirect from = "/" to = "/dashboard" />
99
- </ Switch >
100
- </ Container >
101
- </ main >
102
- < AppAside fixed hidden >
103
- < FullAside />
104
- </ AppAside >
105
- </ div >
106
- < AppFooter >
107
- < FullFooter />
108
- </ AppFooter >
74
+ let displayHtml = null ;
75
+ if ( isAuthenticated ( ) ) {
76
+ displayHtml = ( < div >
77
+ < div className = "app" >
78
+ < AppHeader fixed >
79
+ < FullHeader auth = { this . props . auth } />
80
+ </ AppHeader >
81
+ < div className = "app-body" >
82
+ < AppSidebar fixed display = "lg" >
83
+ < AppSidebarHeader />
84
+ < AppSidebarForm />
85
+ < AppSidebarNav navConfig = { navigation } { ...this . props } />
86
+ < AppSidebarFooter />
87
+ < AppSidebarMinimizer />
88
+ </ AppSidebar >
89
+ < main className = "main" >
90
+ < AppBreadcrumb appRoutes = { routes } />
91
+ < Container fluid >
92
+ < Switch >
93
+ { routes . map ( ( route , idx ) => {
94
+ return route . component ? ( < Route key = { idx } path = { route . path } exact = { route . exact } name = { route . name } render = { props => (
95
+ < route . component { ...props } />
96
+ ) } /> )
97
+ : ( null ) ;
98
+ } ,
99
+ ) }
100
+ < Redirect from = "/" to = "/dashboard" />
101
+ </ Switch >
102
+ </ Container >
103
+ </ main >
104
+ < AppAside fixed hidden >
105
+ < FullAside />
106
+ </ AppAside >
109
107
</ div >
110
- )
111
- }
112
- {
113
- ! isAuthenticated ( ) && (
114
- < h4 >
115
- You are not logged in! Please{ ' ' }
116
- < a
117
- style = { { cursor : 'pointer' } }
118
- // onClick={this.login.bind(this)
119
- onClick = { this . login . bind ( this ) }
120
- >
121
- Log In
122
- </ a >
123
- { ' ' } to continue.
124
- </ h4 >
125
- )
126
- }
127
- </ div >
128
- ) ;
108
+ < AppFooter >
109
+ < FullFooter />
110
+ </ AppFooter >
111
+ </ div >
112
+ </ div >
113
+ ) ;
114
+ } else {
115
+ displayHtml = (
116
+ < div className = "container" >
117
+ < h4 >
118
+ You are not logged in! Please{ ' ' }
119
+ < a
120
+ style = { { cursor : 'pointer' } }
121
+ // onClick={this.login.bind(this)
122
+ onClick = { this . login . bind ( this ) }
123
+ >
124
+ Log In
125
+ </ a >
126
+ { ' ' } to continue.
127
+ </ h4 >
128
+ </ div >
129
+ )
130
+ }
131
+ return displayHtml ;
129
132
}
130
133
}
131
134
0 commit comments