pict-section-login 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example_applications/custom_login/Custom-Login-Application.js +75 -0
- package/example_applications/custom_login/html/index.html +110 -0
- package/example_applications/custom_login/package.json +27 -0
- package/example_applications/harness_app/Harness-App-Application.js +167 -0
- package/example_applications/harness_app/Harness-App-Configuration.json +4 -0
- package/example_applications/harness_app/html/index.html +90 -0
- package/example_applications/harness_app/package.json +28 -0
- package/example_applications/harness_app/providers/PictRouter-HarnessApp.json +24 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-Books.js +172 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-Dashboard.js +158 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-Layout.js +86 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-Login.js +58 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-TopBar.js +157 -0
- package/example_applications/harness_app/views/PictView-HarnessApp-Users.js +188 -0
- package/example_applications/oauth_login/OAuth-Login-Application.js +78 -0
- package/example_applications/oauth_login/html/index.html +57 -0
- package/example_applications/oauth_login/package.json +27 -0
- package/example_applications/orator_login/Orator-Login-Application.js +61 -0
- package/example_applications/orator_login/html/index.html +51 -0
- package/example_applications/orator_login/package.json +27 -0
- package/package.json +53 -0
- package/source/Pict-Section-Login-DefaultConfiguration.js +265 -0
- package/source/Pict-Section-Login.js +533 -0
- package/test/Browser_Integration_tests.js +588 -0
- package/test/Pict-Section-Login_tests.js +593 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
module.exports = (
|
|
2
|
+
{
|
|
3
|
+
"RenderOnLoad": true,
|
|
4
|
+
|
|
5
|
+
"DefaultRenderable": "Login-Container",
|
|
6
|
+
"DefaultDestinationAddress": "#Pict-Login-Container",
|
|
7
|
+
|
|
8
|
+
"TargetElementAddress": "#Pict-Login-Container",
|
|
9
|
+
|
|
10
|
+
// ----- Endpoint Configuration -----
|
|
11
|
+
// Defaults match orator-authentication routes.
|
|
12
|
+
// Override these to point at any custom backend.
|
|
13
|
+
"LoginEndpoint": "/1.0/Authenticate",
|
|
14
|
+
// "POST" sends JSON body { UserName, Password }.
|
|
15
|
+
// "GET" appends /:username/:password to LoginEndpoint.
|
|
16
|
+
"LoginMethod": "POST",
|
|
17
|
+
"LogoutEndpoint": "/1.0/Deauthenticate",
|
|
18
|
+
"CheckSessionEndpoint": "/1.0/CheckSession",
|
|
19
|
+
"OAuthProvidersEndpoint": "/1.0/OAuth/Providers",
|
|
20
|
+
"OAuthBeginEndpoint": "/1.0/OAuth/Begin",
|
|
21
|
+
|
|
22
|
+
// ----- Behavior -----
|
|
23
|
+
"CheckSessionOnLoad": true,
|
|
24
|
+
"ShowOAuthProviders": false,
|
|
25
|
+
|
|
26
|
+
// ----- Data Address -----
|
|
27
|
+
// Where session state is stored in the Pict address space.
|
|
28
|
+
"SessionDataAddress": "AppData.Session",
|
|
29
|
+
|
|
30
|
+
// ----- Templates -----
|
|
31
|
+
"Templates":
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
"Hash": "Pict-Login-Template-Wrapper",
|
|
35
|
+
"Template": "<div class=\"pict-login-card\"><div id=\"pict-login-error\" class=\"pict-login-error\" style=\"display:none\"></div><div id=\"pict-login-form-area\"></div><div id=\"pict-login-oauth-area\"></div><div id=\"pict-login-status-area\" style=\"display:none\"></div></div>"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"Hash": "Pict-Login-Template-Form",
|
|
39
|
+
"Template": "<form id=\"pict-login-form\" class=\"pict-login-form\"><label class=\"pict-login-label\" for=\"pict-login-username\">Username</label><input class=\"pict-login-input\" type=\"text\" id=\"pict-login-username\" name=\"username\" autocomplete=\"username\" placeholder=\"Enter username\" /><label class=\"pict-login-label\" for=\"pict-login-password\">Password</label><input class=\"pict-login-input\" type=\"password\" id=\"pict-login-password\" name=\"password\" autocomplete=\"current-password\" placeholder=\"Enter password\" /><button class=\"pict-login-submit\" type=\"submit\">Log In</button></form>"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"Hash": "Pict-Login-Template-Status",
|
|
43
|
+
"Template": "<div class=\"pict-login-status\"><span class=\"pict-login-dot pict-login-dot--on\"></span><span class=\"pict-login-user-label\">Logged in as <strong id=\"pict-login-display-name\"></strong></span><span class=\"pict-login-user-id\" id=\"pict-login-display-id\"></span><button class=\"pict-login-logout-btn\" id=\"pict-login-logout\" type=\"button\">Log out</button></div>"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Hash": "Pict-Login-Template-OAuthProviders",
|
|
47
|
+
"Template": "<div class=\"pict-login-oauth\"><div class=\"pict-login-oauth-divider\"><span>or sign in with</span></div><div class=\"pict-login-oauth-buttons\" id=\"pict-login-oauth-buttons\"></div></div>"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"Hash": "Pict-Login-Template-Error",
|
|
51
|
+
"Template": "<div class=\"pict-login-error-message\">{~D:Record.Message~}</div>"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
// ----- Renderables -----
|
|
56
|
+
"Renderables":
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"RenderableHash": "Login-Container",
|
|
60
|
+
"TemplateHash": "Pict-Login-Template-Wrapper",
|
|
61
|
+
"DestinationAddress": "#Pict-Login-Container"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
|
|
65
|
+
// ----- CSS -----
|
|
66
|
+
"CSS": `.pict-login-card
|
|
67
|
+
{
|
|
68
|
+
max-width: 400px;
|
|
69
|
+
margin: 2rem auto;
|
|
70
|
+
background: #fff;
|
|
71
|
+
border: 1px solid #D4A373;
|
|
72
|
+
border-top: 4px solid #E76F51;
|
|
73
|
+
border-radius: 6px;
|
|
74
|
+
padding: 1.5rem;
|
|
75
|
+
box-shadow: 0 2px 8px rgba(38,70,83,0.08);
|
|
76
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
77
|
+
color: #264653;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ----- Form ----- */
|
|
81
|
+
.pict-login-form
|
|
82
|
+
{
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 0.75rem;
|
|
86
|
+
}
|
|
87
|
+
.pict-login-label
|
|
88
|
+
{
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
font-size: 0.85rem;
|
|
91
|
+
color: #264653;
|
|
92
|
+
}
|
|
93
|
+
.pict-login-input
|
|
94
|
+
{
|
|
95
|
+
border: 1px solid #D4C4A8;
|
|
96
|
+
background: #FFFCF7;
|
|
97
|
+
padding: 0.55rem 0.7rem;
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
font-size: 0.9rem;
|
|
100
|
+
color: #264653;
|
|
101
|
+
width: 100%;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
}
|
|
104
|
+
.pict-login-input:focus
|
|
105
|
+
{
|
|
106
|
+
outline: none;
|
|
107
|
+
border-color: #E76F51;
|
|
108
|
+
box-shadow: 0 0 0 2px rgba(231,111,81,0.15);
|
|
109
|
+
}
|
|
110
|
+
.pict-login-submit
|
|
111
|
+
{
|
|
112
|
+
background: #E76F51;
|
|
113
|
+
color: #fff;
|
|
114
|
+
border: none;
|
|
115
|
+
padding: 0.6rem 1.25rem;
|
|
116
|
+
border-radius: 4px;
|
|
117
|
+
font-size: 0.9rem;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
margin-top: 0.25rem;
|
|
121
|
+
}
|
|
122
|
+
.pict-login-submit:hover
|
|
123
|
+
{
|
|
124
|
+
background: #C45A3E;
|
|
125
|
+
}
|
|
126
|
+
.pict-login-submit:disabled
|
|
127
|
+
{
|
|
128
|
+
opacity: 0.6;
|
|
129
|
+
cursor: not-allowed;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ----- Error ----- */
|
|
133
|
+
.pict-login-error
|
|
134
|
+
{
|
|
135
|
+
background: #FDECEA;
|
|
136
|
+
border: 1px solid #E76F51;
|
|
137
|
+
color: #8B2500;
|
|
138
|
+
border-radius: 4px;
|
|
139
|
+
padding: 0.6rem 0.8rem;
|
|
140
|
+
font-size: 0.85rem;
|
|
141
|
+
margin-bottom: 0.75rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* ----- Logged-In Status ----- */
|
|
145
|
+
.pict-login-status
|
|
146
|
+
{
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
gap: 0.5rem;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
}
|
|
152
|
+
.pict-login-dot
|
|
153
|
+
{
|
|
154
|
+
width: 10px;
|
|
155
|
+
height: 10px;
|
|
156
|
+
border-radius: 50%;
|
|
157
|
+
flex-shrink: 0;
|
|
158
|
+
}
|
|
159
|
+
.pict-login-dot--on
|
|
160
|
+
{
|
|
161
|
+
background: #2A9D8F;
|
|
162
|
+
box-shadow: 0 0 4px rgba(42,157,143,0.5);
|
|
163
|
+
}
|
|
164
|
+
.pict-login-dot--off
|
|
165
|
+
{
|
|
166
|
+
background: #999;
|
|
167
|
+
}
|
|
168
|
+
.pict-login-user-label
|
|
169
|
+
{
|
|
170
|
+
font-size: 0.9rem;
|
|
171
|
+
}
|
|
172
|
+
.pict-login-user-id
|
|
173
|
+
{
|
|
174
|
+
background: #264653;
|
|
175
|
+
color: #FAEDCD;
|
|
176
|
+
font-size: 0.7rem;
|
|
177
|
+
font-weight: 700;
|
|
178
|
+
padding: 0.15rem 0.5rem;
|
|
179
|
+
border-radius: 9999px;
|
|
180
|
+
}
|
|
181
|
+
.pict-login-logout-btn
|
|
182
|
+
{
|
|
183
|
+
margin-left: auto;
|
|
184
|
+
background: #264653;
|
|
185
|
+
color: #FAEDCD;
|
|
186
|
+
border: none;
|
|
187
|
+
padding: 0.4rem 1rem;
|
|
188
|
+
border-radius: 4px;
|
|
189
|
+
font-size: 0.8rem;
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
}
|
|
193
|
+
.pict-login-logout-btn:hover
|
|
194
|
+
{
|
|
195
|
+
background: #1A3340;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* ----- OAuth ----- */
|
|
199
|
+
.pict-login-oauth
|
|
200
|
+
{
|
|
201
|
+
margin-top: 1rem;
|
|
202
|
+
}
|
|
203
|
+
.pict-login-oauth-divider
|
|
204
|
+
{
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
gap: 0.75rem;
|
|
208
|
+
margin-bottom: 0.75rem;
|
|
209
|
+
color: #999;
|
|
210
|
+
font-size: 0.8rem;
|
|
211
|
+
}
|
|
212
|
+
.pict-login-oauth-divider::before,
|
|
213
|
+
.pict-login-oauth-divider::after
|
|
214
|
+
{
|
|
215
|
+
content: '';
|
|
216
|
+
flex: 1;
|
|
217
|
+
height: 1px;
|
|
218
|
+
background: #D4C4A8;
|
|
219
|
+
}
|
|
220
|
+
.pict-login-oauth-buttons
|
|
221
|
+
{
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 0.5rem;
|
|
225
|
+
}
|
|
226
|
+
.pict-login-oauth-btn
|
|
227
|
+
{
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
gap: 0.5rem;
|
|
232
|
+
padding: 0.55rem 1rem;
|
|
233
|
+
border-radius: 4px;
|
|
234
|
+
font-size: 0.85rem;
|
|
235
|
+
font-weight: 600;
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
text-decoration: none;
|
|
238
|
+
border: 1px solid #D4C4A8;
|
|
239
|
+
background: #fff;
|
|
240
|
+
color: #264653;
|
|
241
|
+
}
|
|
242
|
+
.pict-login-oauth-btn:hover
|
|
243
|
+
{
|
|
244
|
+
background: #F5F0E8;
|
|
245
|
+
}
|
|
246
|
+
.pict-login-oauth-btn--google
|
|
247
|
+
{
|
|
248
|
+
border-color: #4285F4;
|
|
249
|
+
color: #4285F4;
|
|
250
|
+
}
|
|
251
|
+
.pict-login-oauth-btn--google:hover
|
|
252
|
+
{
|
|
253
|
+
background: #EBF2FE;
|
|
254
|
+
}
|
|
255
|
+
.pict-login-oauth-btn--microsoft
|
|
256
|
+
{
|
|
257
|
+
border-color: #00A4EF;
|
|
258
|
+
color: #00A4EF;
|
|
259
|
+
}
|
|
260
|
+
.pict-login-oauth-btn--microsoft:hover
|
|
261
|
+
{
|
|
262
|
+
background: #E6F6FE;
|
|
263
|
+
}
|
|
264
|
+
`
|
|
265
|
+
});
|