Removed /usr/local from CDPATH
[clearscm.git] / maps / JavaScript / CheckEditProfile.js
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File:        $RCSFile$
4 // Revision:    $Revision: 1.1 $
5 // Description: This JavaScript is included in the MAPS edit profile form to 
6 //              check the fields of the form.
7 // Author:      Andrew@DeFaria.com
8 // Created:     Fri Nov 29 14:17:21  2002
9 // Modified:    $Date: 2013/06/12 14:05:47 $
10 // Language:    JavaScript
11 //
12 // (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 //
14 ////////////////////////////////////////////////////////////////////////////////
15 function validate (profile) {
16   with (profile) {
17     fullname = trim_trailing_spaces (fullname);
18     if (fullname.value == "") {
19       alert ("Full name is required!");
20       fullname.focus ();
21       return false;
22     } // if
23
24     email = trim_trailing_spaces (email);
25     if (email.value == "") {
26       alert ("We need your email address - in case you forget your password\nand we need to send it to you.");
27       email.focus ();
28       return false;
29     } else {
30       if (!valid_email_address (email)) {
31         alert ("That email address is invalid!\nMust be <username>@<domainname>\nFor example: Andrew@DeFaria.com.");
32         return false;
33       } // if
34     } // if
35
36     var password_msg = 
37       "To change your password specify both your old and new passwords then\n" +
38       "repeat your new password in the fields provided\n\n" +
39       "To leave your password unchanged leave old, new and repeated\n" +
40       "password fields blank";
41
42     if (old_password.value != "") {
43       if (new_password.value == "") {
44         alert (password_msg);
45         new_password.focus ();
46         return false;
47       } else {
48         if (new_password.value.length < 6) {
49           alert ("Passwords must be greater than 6 characters.");
50           new_password.focus ();
51           return false;
52         } // if
53       } // if
54       if (repeated_password.value == "") {
55         alert (password_msg);
56         repeated_password.focus ();
57         return false;
58       } else {
59         if (repeated_password.value.length < 6) {
60           alert ("Passwords must be greater than 6 characters.");
61           repeated_password.focus ();
62           return false;
63         } // if
64       } // if
65       if (new_password.value != repeated_password.value) {
66         alert ("Sorry but the new password and repeated password are not the same!");
67         new_password.focus ();
68         return false;
69       } // if
70     } else {
71       if (new_password.value != "") {
72         alert (password_msg);
73         new_password.focus ();
74         return false;
75       } // if
76       if (repeated_password.value != "") {
77         alert (password_msg);
78         repeated_password.focus ();
79         return false;
80       } // if
81     } // if
82
83     if (MAPSPOP [0].checked) {
84       alert ("Sorry but MAPSPOP has not yet been implemented");
85       return false;
86     } // if
87
88     if (tag_and_forward [0].checked) {
89       alert ("Sorry but Tag & Forward has not yet been implemented");
90       return false;
91     } // if
92   } // with
93
94   return true;
95 } // validate