Elgg  Version 4.x
changepassword.php
Go to the documentation of this file.
1 <?php
8 
9 $password = get_input('password1', null, false);
10 $password_repeat = get_input('password2', null, false);
11 $user_guid = (int) get_input('u');
13 
14 try {
15  elgg()->accounts->assertValidPassword($password);
16 } catch (RegistrationException $e) {
17  return elgg_error_response($e->getMessage());
18 }
19 
20 if ($password !== $password_repeat) {
21  return elgg_error_response(elgg_echo('RegistrationException:PasswordMismatch'));
22 }
23 
25  return elgg_error_response(elgg_echo('user:password:fail'));
26 }
27 
28 try {
30 } catch (LoginException $e) {
31  return elgg_error_response($e->getMessage());
32 }
33 
34 return elgg_ok_response('', elgg_echo('user:password:success'), '');
$user_guid
get_user($guid)
Get a user object from a GUID.
Definition: users.php:20
Elgg registration action.
Generic parent class for login exceptions.
Could not register a new user for whatever reason.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
$password
$password_repeat
elgg_error_response($message= '', $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
login(\ElggUser $user, $persistent=false)
Logs in a specified .
Definition: sessions.php:249
elgg_ok_response($content= '', $message= '', $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
Login as the specified user.
var elgg
Definition: elgglib.js:4
execute_new_password_request($user_guid, $conf_code, $password=null)
Validate and change password for a user.
Definition: users.php:123