1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
-
- $Id$
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-->
<v:page name="user_edit_pwd"
doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
style="index.xsl"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:vm="http://www.openlinksw.com/vspx/ods/"
xmlns:v="http://www.openlinksw.com/vspx/">
<v:variable persist="0" name="secretq" type="varchar" default="''"/>
<v:variable persist="0" name="secreta" type="varchar" default="''"/>
<v:variable persist="0" name="oid_urlv" type="varchar" default="''"/>
<v:variable persist="0" name="certificate_login" type="integer" default="1"/>
<v:variable persist="0" name="certificate_content" type="varchar" default="null"/>
<v:variable persist="0" name="sioc_limit" type="int" default="10"/>
<v:variable persist="0" name="no_pwd" type="int" default="0"/>
<v:variable persist="0" name="tab_no" type="int" default="0" param-name="tabNo"/>
<v:variable persist="temp" name="cert_del" type="int" default="0" param-name="cert_del"/>
<v:variable persist="temp" name="key_del" type="varchar" default="null" param-name="key_del"/>
<v:variable persist="0" name="cert_edit" type="int" default="null" param-name="cert_edit"/>
<v:before-data-bind>
<![CDATA[
declare pwd, node_id, tmp varchar;
SELECT WAUI_SEC_QUESTION,
WAUI_SEC_ANSWER,
pwd_magic_calc (U_NAME, U_PASSWORD, 1),
WAUI_OPENID_URL
INTO self.secretq,
self.secreta,
pwd,
self.oid_urlv
FROM WA_USER_INFO,
DB.DBA.SYS_USERS
where WAUI_U_ID = U_ID
and U_NAME = self.u_name;
self.sioc_limit := coalesce (USER_GET_OPTION (self.u_name, 'SIOC_POSTS_QUERY_LIMIT'), 10);
if (self.cert_edit is not null and not e.ve_is_post)
{
for select * from WA_USER_CERTS where UC_ID = self.cert_edit do
{
self.certificate_login := UC_LOGIN;
self.certificate_content := UC_CERT;
}
}
tmp := uuid ();
node_id := subseq (tmp, strrchr (tmp, '-'));
if (pwd like '%'||node_id and regexp_match ('[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}', pwd) is not null)
self.no_pwd := 1;
else
self.no_pwd := 0;
]]>
</v:before-data-bind>
<br/>
<div id="b" class="c1">
<div class="tabs">
<v:url name="sec_url_0" value="Password" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
<v:url name="sec_url_3" value="Password recovery" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
<v:url name="sec_url_1" value="OpenID" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
<v:url name="sec_url_4" value="Limits" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
<?vsp
declare ua any;
ua := http_request_header (http_request_header (), 'User-Agent');
if (coalesce (strstr (ua, 'MSIE'), -1) > 0 or regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
{
declare svc_url varchar;
svc_url := (select top 1 WS_CERT_GEN_URL from DB.DBA.WA_SETTINGS);
if (length (svc_url))
{
for (select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY
from SYS_USERS, VSPX_SESSION, WA_USER_INFO
where VS_SID = self.sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID) do
{
declare url, webid varchar;
webid := sioc..person_iri (sioc..user_obj_iri (U_NAME));
url := sprintf ('%s?uri=%U&name=%U&email=%U&organization=%U', svc_url, webid, coalesce (U_FULL_NAME, U_NAME), coalesce (U_E_MAIL, ''), coalesce (WAUI_BORG, ''));
?>
<a name="sec_url" href='<?vsp http (url); ?>' class="tabX">Certificate Generator</a>
<?vsp
}
}
else if (regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
{
goto no_gen_svc;
}
}
else if (not ((coalesce (strstr (ua, 'Windows'), -1) > 0) and (coalesce (strstr (ua, 'Safari'), -1) > 0) and (coalesce (strstr (ua, 'Chrome'), -1) <= 0)))
{
no_gen_svc:;
?>
<v:url name="sec_url_6" value="Certificate Generator" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=6')" xhtml_class="--case when self.tabNo = 6 then 'tabX activeTabX' else 'tabX' end"/>
<?vsp
}
?>
<v:url name="sec_url_5" value="X.509 Certificates" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=5')" xhtml_class="--case when self.tabNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
<v:url name="sec_url_6" value="Certificate & Private Key" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=7')" xhtml_class="--case when self.tabNo = 7 then 'tabX activeTabX' else 'tabX' end"/>
</div>
<div class="contents">
<v:form name="usr_pwd" type="simple" method="POST" action="uiedit_sec.vspx?page=3">
<v:template name="sec_tmpl_0" type="simple" enabled="-- equ (self.tab_no, 0)">
<input type="hidden" value="0" name="tabNo" />
<h2>Change login password</h2>
<p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
<table>
<?vsp if (not self.no_pwd) { ?>
<tr>
<th width="135px"><label for="opwd1">Old password</label></th>
<td>
<v:text xhtml_id="opwd1" name="opwd1" value="" type="password" error-glyph="*"/>
</td>
</tr>
<?vsp } ?>
<tr>
<th><label for="npwd1">New password</label></th>
<td>
<v:text error-glyph="*" xhtml_id="npwd1" name="npwd1" value="" type="password"/>
</td>
</tr>
<tr>
<th><label for="npwd2">Repeat password</label></th>
<td>
<v:text error-glyph="*" xhtml_id="npwd2" name="npwd2" value="" type="password"/>
</td>
</tr>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="user_pwd_change1111" value="Change" action="simple">
<v:on-post>
<![CDATA[
declare pwd_match int;
if (self.vc_is_valid = 0)
return;
declare exit handler for not found
{
signal ('22023', 'Internal error, user does not exist');
};
select equ (pwd_magic_calc (U_NAME, U_PASSWORD, 1), self.opwd1.ufl_value) into pwd_match
from SYS_USERS
where U_NAME = self.u_name and U_IS_ROLE = 0;
if (not pwd_match and not self.no_pwd)
{
self.opwd1.vc_error_message := sprintf ('The old password for "%s" was not correct.', self.u_name);
self.opwd1.ufl_failed := 1;
self.npwd1.ufl_failed := 1;
self.npwd2.ufl_failed := 1;
self.vc_is_valid := 0;
self.npwd1.ufl_value := '';
self.npwd2.ufl_value := '';
self.opwd1.ufl_value := '';
return;
}
if ( length(self.npwd1.ufl_value) < 1 or length(self.npwd1.ufl_value) > 255)
{
self.npwd1.vc_error_message := 'The password value cannot be empty nor longer than 255 chars';
self.vc_is_valid := 0;
return;
}
if (self.npwd1.ufl_value = self.npwd2.ufl_value and length (self.npwd1.ufl_value))
{
if (self.no_pwd)
{
self.opwd1.ufl_value := (SELECT pwd_magic_calc (U_NAME, U_PASSWORD, 1) FROM DB.DBA.SYS_USERS where U_NAME = self.u_name);
}
USER_CHANGE_PASSWORD (self.u_name, self.opwd1.ufl_value, self.npwd1.ufl_value);
self.opwd1.ufl_value := '';
self.msg_msg := 'The password was changed successfully';
--self.pwd_msg.vc_data_bind (e);
}
else
{
self.npwd2.vc_error_message := 'The new values for the password did not match. Please re-enter all fields.';
self.vc_is_valid := 0;
self.npwd2.ufl_failed := 1;
self.opwd1.ufl_failed := 1;
self.npwd2.ufl_failed := 1;
}
self.npwd1.ufl_value := '';
self.npwd2.ufl_value := '';
self.opwd1.ufl_value := '';
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</v:template>
<v:template name="sec_tmpl_1" type="simple" enabled="-- equ (self.tab_no, 1)">
<input type="hidden" value="1" name="tabNo" />
<br />
<table>
<tr>
<th width="135px">
<label for="oid_url1">OpenID URL</label>
</th>
<td nowrap="nowrap">
<v:text error-glyph="*" xhtml_id="oid_url1" name="oid_url1" value="--self.oid_urlv" xhtml_size="100" xhtml_class="_validate_ _uri_ _canEmpty_" xhtml_onblur="javascript: validateField(this);" />
<div style="display:inline; color:red;"><v:error-summary match="oid_url1" /></div>
</td>
</tr>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="bt_set6" value="Save OpenID" action="simple" xhtml_onclick="return validateInputs(this);">
<v:on-post>
<![CDATA[
if (self.vc_is_valid = 0)
return;
declare err any;
err := ODS..openid_url_set (self.u_id, self.oid_url1.ufl_value);
if (err is not null)
{
self.vc_is_valid := 0;
self.vc_error_message := err;
return;
}
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=1');
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</v:template>
<v:template name="sec_tmpl_3" type="simple" enabled="-- equ (self.tab_no, 3)">
<input type="hidden" value="3" name="tabNo" />
<h2>Password recovery questions</h2>
<p class="fm_expln">Manage password recovery procedure. Set verification question and answer.</p>
<table>
<tr>
<th width="135px">
<label for="sec_question">Secret question</label>
</th>
<td nowrap="nowrap">
<v:text error-glyph="*" name="sec_question" xhtml_id="sec_qst" value="--self.secretq">
<v:validator test="length" min="0" max="800" message="Security question cannot be longer then 800 chars" empty-allowed="1" name="vv_secq1"/>
<v:validator test="sql" expression="length(trim(self.sec_question.ufl_value)) > 800" name="vv_secq2" message="Security question cannot be longer then 800 chars"/>
</v:text>
<script type="text/javascript">
function setSecQuestion()
{
var S = document.getElementById('dummy_1233211_dummy');
var V = S[S.selectedIndex].value;
document.getElementById('sec_qst').value = V;
}
</script>
<select name="dummy_1233211_dummy" id="dummy_1233211_dummy" onchange="setSecQuestion()">
<option value="">~pick predefined~</option>
<option VALUE="First Car">First Car</option>
<option VALUE="Mothers Maiden Name">Mothers Maiden Name</option>
<option VALUE="Favorite Pet">Favorite Pet</option>
<option VALUE="Favorite Sports Team">Favorite Sports Team</option>
</select>
<div style="display:inline; color:red;"><v:error-summary match="sec_question" /></div>
</td>
</tr>
<tr>
<th><label for="sec_answer">Secret answer</label></th>
<td nowrap="nowrap">
<v:text error-glyph="*" xhtml_id="sec_answer" name="sec_answer" value="--self.secreta">
<v:validator test="length" min="0" max="800" message="Security answer cannot be longer then 800 chars" name="vv_seca1" empty-allowed="1"/>
</v:text>
<div style="display:inline; color:red;"><v:error-summary match="sec_answer" /></div>
</td>
</tr>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="user_sset" value="Save" action="simple">
<v:on-post>
<![CDATA[
if(self.vc_is_valid = 0)
return;
WA_USER_EDIT (self.u_name, 'SEC_QUESTION', self.sec_question.ufl_value);
WA_USER_EDIT (self.u_name, 'SEC_ANSWER', self.sec_answer.ufl_value);
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=3');
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</v:template>
<v:template name="sec_tmpl_4" type="simple" enabled="-- equ (self.tab_no, 4)">
<input type="hidden" value="4" name="tabNo" />
<h2>Applications restrictions</h2>
<table>
<tr>
<th width="135px"><label for="sioc_limit1">SIOC query result limit</label></th>
<td nowrap="nowrap">
<v:text error-glyph="*" xhtml_id="sioc_limit1" name="sioc_limit1" value="--self.sioc_limit" />
<div style="display:inline; color:red;"><v:error-summary match="sioc_limit" /></div>
</td>
</tr>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="bt_cncl_5" value="Cancel" action="simple" xhtml_onclick="javascript: return initLoadProfile();">
<v:on-post>
self.vc_redirect (sprintf ('uhome.vspx?ufname=%U&l=1', self.u_name));
</v:on-post>
</v:button>
<v:button name="bt_set1" value="Save Restrictions" action="simple">
<v:on-post>
<![CDATA[
self.sioc_limit1.ufl_value := atoi (self.sioc_limit1.ufl_value);
if ((self.sioc_limit1.ufl_value < 1) or (self.sioc_limit1.ufl_value > 1000))
{
self.sioc_limit1.vc_error_message := 'Positive number between 1 and 1000 is required';
self.vc_is_valid := 0;
return;
}
USER_SET_OPTION (self.u_name, 'SIOC_POSTS_QUERY_LIMIT', self.sioc_limit1.ufl_value);
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=4');
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</v:template>
<v:template name="sec_tmpl_5" type="simple" enabled="-- equ (self.tab_no, 5)">
<h2>User Certificates</h2>
<p>Manage certificates used for authentication.</p>
<input type="hidden" value="5" name="tabNo" />
<table class="listing">
<tr class="listing_header_row">
<th>Subject</th>
<th>Created</th>
<th>Fingerprint</th>
<th>Login enabled</th>
<th>Action</th>
</tr>
<?vsp
if (self.cert_del is not null)
delete from WA_USER_CERTS where UC_ID = self.cert_del and UC_U_ID = self.u_id;
for (select UC_ID, UC_CERT, UC_LOGIN, UC_FINGERPRINT, UC_TS from WA_USER_CERTS where UC_U_ID = self.u_id order by UC_TS desc) do
{
?>
<tr>
<td><?vsp http_value (get_certificate_info (2, cast (UC_CERT as varchar), 0, ''), 'b'); ?></td>
<td><?vsp http_value (wa_abs_date (UC_TS), 'b'); ?></td>
<td><?vsp http_value (UC_FINGERPRINT, 'b'); ?></td>
<td><?V case when UC_LOGIN = 1 then 'Yes' else 'No' end ?></td>
<td>
<v:url name="ce1" value="Edit" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=5&cert_edit=%d', UC_ID)" render-only="1"/>
<v:url name="ce2" value="Delete" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=5&cert_del=%d', UC_ID)" render-only="1"/>
</td>
</tr>
<?vsp
}
?>
</table>
<br/>
<h3>X.509 Certificate</h3>
<table width="100%">
<?vsp if (length (self.certificate_content)) { ?>
<tr>
<th width="135px">
Subject
</th>
<td align="left">
<?vsp
http_value (get_certificate_info (2, cast(self.certificate_content as varchar), 0, ''),'b');
?>
</td>
</tr>
<tr>
<th width="135px">
Agent ID
</th>
<td align="left">
<?vsp
http_value (ODS.ODS_API.SSL_WEBID_GET (cast(self.certificate_content as varchar)),'b');
?>
</td>
</tr>
<tr>
<th width="135px">
Fingerprint
</th>
<td align="left">
<?vsp
http_value (get_certificate_info (6, cast(self.certificate_content as varchar), 0, ''),'b');
?>
</td>
</tr>
<?vsp } ?>
<tr>
<td colspan="2" align="left">
<label>
<v:check-box name="cert_import" value="1" xhtml_id="cert_import" auto-submit="1">
<v:after-data-bind>
<![CDATA[
if (e.ve_is_post and e.ve_initiator is not null and e.ve_initiator.vc_name = control.vc_name)
{
control.ufl_selected := atoi (get_keyword ('cert_import', e.ve_params, '0'));
}
]]>
</v:after-data-bind>
</v:check-box>
<b>Import from local file</b>
</label>
</td>
</tr>
<v:template type="simple" condition="self.cert_import.ufl_selected">
<tr>
<th width="135px">
File to import
</th>
<td align="left">
<input type="file" name="cert_file" />
</td>
</tr>
</v:template>
<v:template type="simple" condition="not self.cert_import.ufl_selected">
<tr>
<td colspan="2" align="left">
<v:textarea name="cert1" value="--self.certificate_content" xhtml_cols="70" xhtml_rows="20" />
</td>
</tr>
</v:template>
<tr>
<td colspan="2" align="left">
<label>
<v:check-box name="cert_login" value="1" xhtml_id="cert_login" >
<v:after-data-bind>
if (not e.ve_is_post)
control.ufl_selected := self.certificate_login;
</v:after-data-bind>
</v:check-box>
<b>Enable Automatic WebID Login</b>
</label>
</td>
</tr>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="bt_cncl_6" value="Cancel" action="simple" >
<v:on-post>
<![CDATA[
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=5');
]]>
</v:on-post>
</v:button>
<v:button name="bt_set2" value="Save Certificate" action="simple">
<v:on-post>
<![CDATA[
declare agent, mail varchar;
declare cert any;
if(self.vc_is_valid = 0)
return;
if (self.cert_import.ufl_selected)
{
cert := get_keyword ('cert_file', e.ve_params);
}
else
{
cert := self.cert1.ufl_value;
}
agent := ODS.ODS_API.SSL_WEBID_GET (cert);
mail := FOAF_SSL_MAIL_GET (cert);
if ((agent is null and mail is null and length (cert)) or (0 = length (cert)))
{
self.vc_is_valid := 0;
self.vc_error_message := 'The certificate must be in PEM format and must have Alternate Name attribute.';
return;
}
if (self.cert_edit is null)
{
insert into WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN, UC_TS)
values (self.u_id, cert, get_certificate_info (6, cert, 0, ''), self.cert_login.ufl_selected, now ());
}
else
{
update WA_USER_CERTS
set UC_CERT = cert,
UC_FINGERPRINT = get_certificate_info (6, cert, 0, ''),
UC_LOGIN = self.cert_login.ufl_selected
where UC_U_ID = self.u_id and UC_ID = self.cert_edit ;
self.cert_edit := null;
}
commit work;
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=5');
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</v:template>
<v:template name="sec_tmpl_6" type="simple" enabled="-- equ (self.tab_no, 6)">
<input type="hidden" value="6" name="tabNo" />
<h3>X.509 Certificate Parameters</h3>
<iframe id="cert" src="cert.vsp?sid=<?V self.sid ?>" width="650" height="270" frameborder="0" scrolling="auto">
<p>Your browser does not support iframes.</p>
</iframe>
</v:template>
<v:template name="sec_tmpl_7" type="simple" enabled="-- equ (self.tab_no, 7)">
<input type="hidden" value="7" name="tabNo" />
<table class="listing">
<tr class="listing_header_row">
<th>Name</th>
<th>Type</th>
<th>Action</th>
</tr>
<?vsp
declare key_no, sk int;
if (self.key_del is not null)
{
USER_KEY_DELETE (self.u_name, self.key_del);
set_user_id (self.u_name);
xenc_key_remove (self.key_del);
set_user_id ('dba');
}
key_no := 0;
sk := (select WAUI_SALMON_KEY from WA_USER_INFO where WAUI_U_ID = self.u_id);
for (select xenc_key, xenc_type from ods_user_keys (username) (xenc_key varchar, xenc_type varchar) x where username = self.u_name) do
{
?>
<tr>
<td>
<?vsp if (sk = xenc_key) { ?>
<input type="radio" name="defk" value="<?V xenc_key ?>" checked="true"/>
<?vsp } else { ?>
<input type="radio" name="defk" value="<?V xenc_key ?>" />
<?vsp } ?>
<?vsp http_value (xenc_key, 'b'); ?>
</td>
<td><?vsp http_value (xenc_type, 'b'); ?></td>
<td>
<v:url name="ce7" value="Delete" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=7&key_del=%U', xenc_key)" render-only="1"/>
</td>
</tr>
<?vsp
key_no := key_no + 1;
}
if (not key_no)
http ('<tr><td colspan="4">No keys</td></tr>');
?>
</table>
<br/>
<span class="fm_ctl_btn">
<v:button name="bt_def_1" value="Remove Default" action="simple" >
<v:on-post>
<![CDATA[
update WA_USER_INFO set WAUI_SALMON_KEY = null where WAUI_U_ID = self.u_id;
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
]]>
</v:on-post>
</v:button>
<v:button name="bt_def_2" value="Set Default" action="simple" >
<v:on-post>
<![CDATA[
declare k any;
k := get_keyword ('defk', params, null);
update WA_USER_INFO set WAUI_SALMON_KEY = k where WAUI_U_ID = self.u_id;
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
]]>
</v:on-post>
</v:button>
</span>
<br/><br/>
<fieldset>
<legend><b>Private Key</b></legend>
<table>
<tr>
<th width="135px">
Key Name (*)
</th>
<td align="left">
<v:text name="kn" value="">
</v:text>
</td>
</tr>
<tr>
<td></td>
<td>
<label>
<v:check-box name="inpsel" value="1" xhtml_id="inpsel" auto-submit="1">
<v:after-data-bind>
<![CDATA[
if (e.ve_is_post and e.ve_initiator is not null and e.ve_initiator.vc_name = control.vc_name)
{
control.ufl_selected := atoi (get_keyword ('inpsel', e.ve_params, '0'));
}
]]>
</v:after-data-bind>
</v:check-box>
Import key from local file
</label>
</td>
</tr>
<v:template type="simple" condition="self.inpsel.ufl_selected">
<tr>
<th>
File to import
</th>
<td align="left">
<input type="file" name="k_value" value="Select Key"/>
</td>
</tr>
<tr>
<th>
File Password
</th>
<td align="left">
<v:text name="k_pwd" type="password" value="" /><br/>
</td>
</tr>
</v:template>
<v:template type="simple" condition="not self.inpsel.ufl_selected">
<tr>
<th>
Key Type
</th>
<td align="left">
<v:select-list name="kt">
<v:item name="RSA" value="RSA"/>
<v:item name="DSA" value="DSA"/>
</v:select-list>
</td>
</tr>
<tr>
<th>
Key Length
</th>
<td align="left">
<v:select-list name="kl">
<v:item name="512" value="512"/>
<v:item name="1024" value="1024"/>
<v:item name="2048" value="2048"/>
</v:select-list>
</td>
</tr>
</v:template>
<tr>
<td colspan="2" class="ctrl">
<span class="fm_ctl_btn">
<v:button name="bt_cncl_7" value="Cancel" action="simple" >
<v:on-post>
<![CDATA[
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
]]>
</v:on-post>
</v:button>
<v:button name="bt_gen7" value="Generate Key" action="simple" enabled="--equ (self.inpsel.ufl_selected, 0)">
<v:on-post>
<![CDATA[
if (self.vc_is_valid = 0)
return;
declare exit handler for sqlstate '*', not found
{
self.vc_error_message := __SQL_MESSAGE;
self.vc_is_valid := 0;
return;
};
declare kn varchar;
declare kl integer;
kn := trim (self.kn.ufl_value);
if (not length (kn))
{
self.vc_error_message := 'Please specify Key Name';
self.vc_is_valid := 0;
return;
}
kl := atoi (self.kl.ufl_value);
set_user_id (self.u_name);
set_qualifier ('DB');
if (self.kt.ufl_value = 'RSA')
{
xenc_key_RSA_create (self.kn.ufl_value, kl);
}
else if (self.kt.ufl_value = 'DSA')
{
xenc_key_DSA_create (self.kn.ufl_value, kl);
}
USER_KEY_STORE (self.u_name, kn, self.kt.ufl_value, 'DER', '');
set_user_id ('dba');
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
]]>
</v:on-post>
</v:button>
<v:button name="bt_set7" value="Import Key" action="simple" enabled="--equ (self.inpsel.ufl_selected, 1)">
<v:on-post>
<![CDATA[
if (self.vc_is_valid = 0)
return;
declare exit handler for sqlstate '*', not found
{
self.vc_error_message := __SQL_MESSAGE;
self.vc_is_valid := 0;
return;
};
declare kn varchar;
kn := trim (self.kn.ufl_value);
if (not length (kn))
{
self.vc_error_message := 'Please specify Key Name';
self.vc_is_valid := 0;
return;
}
if (not length (get_keyword ('k_value', e.ve_params)))
{
self.vc_error_message := 'Please specify file to import';
self.vc_is_valid := 0;
return;
}
set_user_id (self.u_name);
USER_KEY_LOAD (kn, get_keyword ('k_value', e.ve_params), 'X.509', 'PKCS12', self.k_pwd.ufl_value, null, 1);
self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
]]>
</v:on-post>
</v:button>
</span>
</td>
</tr>
</table>
</fieldset>
</v:template>
</v:form>
</div>
</div>
</v:page>
|