UNCLASSIFIED

Skip to content
Snippets Groups Projects
Commit 7287f3eb authored by Benjamin Allison's avatar Benjamin Allison
Browse files

update small fixes

parent 8c7809fd
1 merge request!115bug fix, features added.
......@@ -33,9 +33,9 @@ function get_info_from_cert($raw_cert)
$result["user_org"] = $parsed_cert["subject"]["OU"][2];
// get_full_name
$user_cn = $parsed_cert["subject"]["CN"];
$user_cn = str_replace(" ", "", $parsed_cert["subject"]["CN"]);
preg_match('/^(.*)\.([0-9]{10})$/',$user_cn, $user_info);
$result["user_info"] = $user_info;
$result["user_info"] =$user_info;
$user_cn_name = explode('.',strtolower($user_info[1]));
$result["user_cn_first"] = ucfirst($user_cn_name[1]);
$result["user_cn_last"] = ucfirst($user_cn_name[0]);
......@@ -47,16 +47,15 @@ function get_info_from_cert($raw_cert)
$result["user_type"] = "trainee";
$result["user_name"] = $result["alt_name"];
$result["user_email"] = $result["alt_name"] . "@trainee.cybbh.space";
$result["user_type"] = "trainee";
} else {
$subjectAltName = strtolower($parsed_cert["extensions"]["subjectAltName"]);
if (strpos($subjectAltName, "email:") === False) {
if(isset($_GET["OVERRIDE"])) {
$result["user_type"] = "trainee";
$result["user_name"] = $result["alt_name"];
$result["user_email"] = $result["alt_name"] . "@account.cybbh.space";
$result["user_type"] = "trainee";
$result["user_name"] = $result["alt_name"];
$result["user_email"] = $result["alt_name"] . "@account.cybbh.space";
} else {
throw new Exception("Email not present in certificate.");
throw new Exception("Email not present in certificate.");
}
} else if ($result["user_org"] == "US" || strpos($subjectAltName, "@mail.mil") !== False) {
preg_match('/^email:((.*)\.(mil|ctr|civ)@(.*)), .*$/',$subjectAltName,$user_email);
......@@ -65,7 +64,7 @@ function get_info_from_cert($raw_cert)
$result["user_name"] = $user_email[2];
$result["user_email"] = $user_email[1];
} else{
preg_match('/^.*email:((.*)@([^, ]*)),? ?.*$/',$subjectAltName,$user_email);
preg_match('/^.*email:((.*)@([^, ]*)),? ?.*$/',$subjectAltName,$user_email);
$result["user_type"] = "unk";
$result["user_mail_domain"] = $user_email[3];
$result["user_name"] = $user_email[2];
......@@ -493,6 +492,17 @@ case "create";
}
display_output($output);
break;
case "do_test";
// $cert="";
$user_info = get_info_from_cert($cert);
var_dump($user_info);
var_dump(check_account($user_info["user_name"],$user_info["alt_name"]));
// display_output(create_account($user_info));
die();
break;
}
if($NOJS)
......
......@@ -271,7 +271,12 @@ $(function() {
</p>
{{if type == "trainee" }}
<br />
<p class="warning"> Note: You are not using your email certificate! Please close your browser and try again with your email certificate. Only proceed if you do not have an email certificate configured on your CAC.</p>
<p class="warning"> Note: You are not using your email certificate. If you registered an account with your email certificate, you should continue to use that certificate to access your account.
<br>
<br>
Only proceed if you want to register a new account. Please note that if you had an account using your email certificate, you will lose the ability to reset your old account once you register using the new user id method.
<br><br>If you have recently renewed your CAC, had an old user ID derived from the email cert, and no longer have an email certificate, please contact the VTA administrators to assist in migrating your old account to a new user id.</p>
{{/if}}
</div>
<div id="account_info_container" class="account_info">
......@@ -339,4 +344,4 @@ $(function() {
</div>
</body>
</html>
\ No newline at end of file
</html>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment