Commits

p2501  committed 2133340

Adding get forgotten password by email, and improving raw action in elggpg

  • Participants
  • Parent commits 05160e5

Comments (0)

Files changed (4)

File elgg/actions/user/requestnewpassword.php

 global $CONFIG;
 
 $username = get_input('username');
+$email = get_input('email');
 
 $access_status = access_get_show_hidden_status();
 access_show_hidden_entities(true);
-$user = get_user_by_username($username);
+
+if($username){
+	$user = get_user_by_username($username);
+}else if($email){
+	$user = get_user_by_email($email);
+}
+
 if ($user) {
 	if ($user->validated) {
 		if (send_new_password_request($user->guid)) {

File elgg/mod/elggpg/raw.php

 //require_once 'Crypt/GPG.php';
 
 header("Content-type: text/plain");
-if (!isloggedin()) {
-  forward();
-}
 
 //$gpg = new Crypt_GPG(array('homedir' => elggpg_get_gpg_home()));
 //echo $gpg->exportPublicKey($user->email);
 	}
 	echo 'true';
 } elseif ($userids) {
+	gatekeeper();
 	$user_guids = explode(',', $_SESSION['user']->guid . ',' . $userids);
 	$keyList = getKeyList($user_guids);
 	echo json_encode($keyList);
 
 } elseif ($accessid) {
+	gatekeeper();
 	$members = get_members_of_access_collection($accessid);
 	$keyList = getKeyList($members);
 	echo json_encode($keyList);

File elgg/mod/elggpg/views/default/elggpg/menuother.php

 	
 <?php
 
-	}
+	}else{?>
+	<p class="user_menu_messages">
+                <a href="<?php echo $vars['url']; ?>pg/gpg/raw/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("elggpg:view"); ?></a>
+        </p>
 
-?>
+<?php }?>

File elgg/views/default/account/forms/forgotten_password.php

 $form_body = "<p>" . elgg_echo('user:password:text') . "</p>";
 $form_body .= "<p><label>". elgg_echo('username') . " "
 	. elgg_view('input/text', array('internalname' => 'username')) . "</label></p>";
+
+$form_body .= "<p><label>". elgg_echo('email') . " "
+	. elgg_view('input/text', array('internalname' => 'email')) . "</label></p>";
 $form_body .= elgg_view('input/captcha');
 $form_body .= "<p>" . elgg_view('input/submit', array('value' => elgg_echo('request'))) . "</p>";
 
+
 ?>
 <div class="contentWrapper">
 <?php
 	'body' => $form_body)
 );
 ?>
-</div>
+</div>