Code Duplication    Length = 3-6 lines in 6 locations

actions/login.php 1 location

@@ 35-37 (lines=3) @@
32
}
33
34
// check if logging in with email address
35
if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
36
	$username = $users[0]->username;
37
}
38
39
$result = elgg_authenticate($username, $password);
40
if ($result !== true) {

actions/user/requestnewpassword.php 1 location

@@ 12-14 (lines=3) @@
9
$username = get_input('username');
10
11
// allow email addresses
12
if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
13
	$username = $users[0]->username;
14
}
15
16
$user = get_user_by_username($username);
17
if ($user) {

mod/cp_notifications/actions/cp_notifications/request_new_password.php 1 location

@@ 13-15 (lines=3) @@
10
$username = get_input('username');
11
12
// allow email addresses
13
if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
14
	$username = $users[0]->username;
15
}
16
17
$user = get_user_by_username($username);
18
if ($user) {

mod/uservalidationbyemail/start.php 1 location

@@ 173-178 (lines=6) @@
170
	access_show_hidden_entities(TRUE);
171
172
	// check if logging in with email address
173
	if (strpos($username, '@') !== false) {
174
		$users = get_user_by_email($username);
175
		if ($users) {
176
			$username = $users[0]->username;
177
		}
178
	}
179
180
	$user = get_user_by_username($username);
181
	if ($user && isset($user->validated) && !$user->validated) {

mod/wet4/actions/login.php 1 location

@@ 35-37 (lines=3) @@
32
}
33
34
// check if logging in with email address
35
if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
36
	$username = $users[0]->username;
37
}
38
39
$result = elgg_authenticate($username, $password);
40
if ($result !== true) {

mod/wet4/actions/user/requestnewpassword.php 1 location

@@ 16-18 (lines=3) @@
13
$username = get_input('username');
14
15
// allow email addresses
16
if (strpos($username, '@') !== false && ($users = get_user_by_email($username))) {
17
	$username = $users[0]->username;
18
}
19
20
$user = get_user_by_username($username);
21
if ($user) {