home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************\
- * *
- * Change.jcf - Custom Security Form Classes *
- * *
- * Updated 11/07/96 by IntraBuilder Samples Group *
- * $Revision: 1.1 $ *
- * *
- * Copyright (c) 1996, Borland International, Inc. All rights reserved. *
- * *
- \****************************************************************************/
- //
- // smChangePasswordForm
- //
- // You need to set two custom properties of this form:
- //
- // security - assign a SecurityManager object that has already logged in
- // callingForm - assign a form reference. Focus is returned to this form
- //
- class smChangePasswordForm extends Form custom {
- with (this) {
- height = 14;
- left = 0;
- top = 0;
- width = 76;
- title = "Change Password";
- }
-
-
- with (this.currentHTML = new HTML(this)){
- height = 1;
- top = 5;
- width = 26;
- color = "black";
- text = "Current password ";
-
- }
-
- with (this.currentText = new Password(this)){
- left = 26;
- top = 5;
- width = 24;
- value = "";
-
- }
-
- with (this.newHTML = new HTML(this)){
- height = 1;
- top = 6;
- width = 26;
- color = "black";
- text = "New password ";
-
- }
-
- with (this.newText = new Password(this)){
- left = 26;
- top = 6;
- width = 24;
- value = "";
-
- }
-
- with (this.confirmHTML = new HTML(this)){
- height = 1;
- top = 7;
- width = 26;
- color = "black";
- text = "Confirm new password ";
-
- }
-
- with (this.confirmText = new Password(this)){
- left = 26;
- top = 7;
- width = 24;
- value = "";
-
- }
-
- with (this.submitButton = new Button(this)){
- onServerClick = class::submitButton_onServerClick;
- top = 9;
- width = 10.5;
- text = "Submit";
-
- }
-
- with (this.clearButton = new Button(this)){
- onClick = {;this.form.currentText.value = this.form.newText.value = this.form.confirmText.value = ''};
- left = 16;
- top = 9;
- width = 10.5;
- text = "Clear";
-
- }
-
- with (this.failedHTML = new HTML(this)){
- height = 1;
- top = 5;
- width = 63;
- color = "black";
- text = "<h2>Change Status</h2>";
- pageno = 2;
-
- }
-
- with (this.messageHTML = new HTML(this)){
- height = 2;
- top = 6;
- width = 63;
- color = "black";
- text = "message ";
- pageno = 2;
-
- }
-
- with (this.backButton2 = new Button(this)){
- onServerClick = {;this.form.currentText.value = this.form.newText.value = this.form.confirmText.value = "" ;this.form.pageno = 1};
- top = 9;
- width = 10.5;
- text = "Back";
- pageno = 2;
-
- }
-
- function submitButton_onServerClick()
- {
- var preludeText = "Password Not Changed: ";
- if (this.form.newText.value == this.form.confirmText.value) {
- try {
- this.form.security.changePassword( this.form.currentText.value,
- this.form.newText.value);
- preludeText = "Password was changed: ";
- this.form.callingForm.open();
- this.form.release();
- }
- catch (Exception e) {
- this.form.messageHTML.text = preludeText + e.message + " (" + e.code + ")";
- this.form.pageno = 2;
- }
- }
- else {
- this.form.messageHTML.text = preludeText + "Confirmation does not match password";
- this.form.pageno = 2;
- }
- }
-
- function backButton_onServerClick()
- {
- try {
- this.form.callingForm.open();
- }
- catch (Exception e) {
- this.form.messageHTML.text = "Error returning to calling form:"
- + e.message + " (" + e.code + ")";
- this.form.pageno = 2
- }
- }
-
- }
-