Add Complex Password Validation to Web Admin

This section contains scripts that hMailServer has contributed with. hMailServer 5 is needed to use these.
Post Reply
isaac_ho
New user
New user
Posts: 20
Joined: 2005-10-06 06:36

Add Complex Password Validation to Web Admin

Post by isaac_ho » 2016-12-14 09:27

1. Modify the file /include/formcheck.js

In function inputCheck(input,type)

put the following codes

Code: Select all

	// Complex Password Modification
	case 'password':
	expression	= /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,100}$/;
	break;
	// End Complex Password Modification
above

Code: Select all

	case '':
	break;

2. Modify the file /hm_account.php

replace these codes

Code: Select all

	<td><input type="password" name="accountpassword" value=""></td>
by

Code: Select all

	<td>
		<!-- Complex Password Modification -->
		<input type="password" name="accountpassword" value="" checktype="password" checkmessage="<?php EchoTranslation("Password")?>"><br>
		Password must between 8-100 characters, contain at least 1 lowercase letter, 1 uppercase letter, 1 numeric digit, and 1 special character.
		<!-- End Complex Password Modification -->
	</td>
Best regards
Isaac Ho

Post Reply