@@ -124,8 +124,6 @@ feature -- Router
124
124
a_router .handle (" /account/new-password" , create {WSF_URI_AGENT_HANDLER }.make (agent handle_new_password (a_api , ?, ?)), a_router .methods_get_post )
125
125
a_router .handle (" /account/reset-password" , create {WSF_URI_AGENT_HANDLER }.make (agent handle_reset_password (a_api , ?, ?)), a_router .methods_get_post )
126
126
a_router .handle (" /account/change/{field}" , create {WSF_URI_TEMPLATE_AGENT_HANDLER }.make (agent handle_change_field (a_api , ?, ?)), a_router .methods_get_post )
127
-
128
- a_router .handle (" /user/{uid}" , create {CMS_USER_HANDLER }.make (a_api ), a_router .methods_get )
129
127
end
130
128
131
129
feature -- Hooks configuration
@@ -206,6 +204,23 @@ feature -- Hooks configuration
206
204
end
207
205
end
208
206
207
+ feature -- Handler / Constants
208
+
209
+ auth_strategy_execution_variable_name : STRING = " auth_strategy"
210
+ -- Exevc
211
+
212
+ auth_strategy (req : WSF_REQUEST ): detachable READABLE_STRING_ 8
213
+ -- Strategy used by current authentication.
214
+ -- note: if user is authenticated..
215
+ do
216
+ if
217
+ attached {READABLE_STRING_GENERAL } req .execution_variable (auth_strategy_execution_variable_name ) as s and then
218
+ s .is_valid_as_string_ 8
219
+ then
220
+ Result := s .to_string_ 8
221
+ end
222
+ end
223
+
209
224
feature -- Handler
210
225
211
226
handle_account (api : CMS_API ; req : WSF_REQUEST ; res : WSF_RESPONSE )
@@ -214,17 +229,44 @@ feature -- Handler
214
229
l_user : detachable CMS_USER
215
230
b : STRING
216
231
lnk : CMS_LOCAL_LINK
232
+ f : CMS_FORM
233
+ tf : WSF_FORM_TEXT_INPUT
217
234
do
218
235
create {GENERIC_VIEW_CMS_RESPONSE } r .make (req , res , api )
219
236
create b .make_empty
220
237
l_user := r .user
238
+ create f .make (r .location , " roccms-user-view" )
221
239
if attached smarty_template_block (Current , " account_info" , api ) as l_tpl_block then
222
240
l_tpl_block .set_weight (-10 )
223
241
r .add_block (l_tpl_block , " content" )
224
242
else
225
243
debug (" cms" )
226
244
r .add_warning_message (" Error with block [resources_page]" )
227
245
end
246
+ if l_user /= Void then
247
+ create tf .make_with_text (" username" , l_user .name )
248
+ tf .set_label (" Username" )
249
+ f .extend (tf )
250
+ if attached l_user .email as l_email then
251
+ create tf .make_with_text (" email" , l_email .to_string_ 32 )
252
+ tf .set_label (" Email" )
253
+ f .extend (tf )
254
+ end
255
+ if attached l_user .profile_name as l_prof_name then
256
+ create tf .make_with_text (" profile_name" , l_prof_name )
257
+ tf .set_label (" Profile name" )
258
+ f .extend (tf )
259
+ end
260
+ create tf .make_with_text (" creation" , api .formatted_date_time_yyyy_mm_dd (l_user .creation_date ))
261
+ tf .set_label (" Creation date" )
262
+ f .extend (tf )
263
+
264
+ if attached l_user .last_login_date as dt then
265
+ create tf .make_with_text (" last_login" , api .formatted_date_time_ago (dt ))
266
+ tf .set_label (" Last login" )
267
+ f .extend (tf )
268
+ end
269
+ end
228
270
end
229
271
230
272
if r .is_authenticated then
@@ -237,6 +279,9 @@ feature -- Handler
237
279
r .add_to_primary_tabs (lnk )
238
280
end
239
281
282
+ api .hooks .invoke_form_alter (f , Void , r )
283
+ f .append_to_html (r .wsf_theme , b )
284
+
240
285
r .set_main_content (b )
241
286
242
287
if l_user = Void then
@@ -251,17 +296,20 @@ feature -- Handler
251
296
l_user : detachable CMS_USER
252
297
b : STRING
253
298
lnk : CMS_LOCAL_LINK
299
+ l_form : CMS_FORM
254
300
do
255
301
create {GENERIC_VIEW_CMS_RESPONSE } r .make (req , res , api )
256
302
create b .make_empty
257
303
l_user := r .user
304
+ create l_form .make (r .location , " roccms-user-edit" )
258
305
if attached smarty_template_block (Current , " account_edit" , api ) as l_tpl_block then
259
306
l_tpl_block .set_weight (-10 )
260
307
r .add_block (l_tpl_block , " content" )
261
308
else
262
309
debug (" cms" )
263
310
r .add_warning_message (" Error with block [resources_page]" )
264
311
end
312
+ -- Build CMS form...
265
313
end
266
314
create lnk .make (" View" , " account/" )
267
315
lnk .set_weight (1 )
@@ -287,6 +335,8 @@ feature -- Handler
287
335
f .append_to_html (r .wsf_theme , b )
288
336
end
289
337
338
+ l_form .append_to_html (r .wsf_theme , b )
339
+
290
340
r .set_main_content (b )
291
341
292
342
if l_user = Void then
@@ -336,7 +386,7 @@ feature -- Handler
336
386
loc : STRING
337
387
do
338
388
create {GENERIC_VIEW_CMS_RESPONSE } r .make (req , res , api )
339
- if attached { READABLE_STRING_ 8 } api . execution_variable ( " auth_strategy " ) as l_auth_strategy then
389
+ if attached auth_strategy ( req ) as l_auth_strategy then
340
390
loc := l_auth_strategy
341
391
else
342
392
loc := " "
0 commit comments