Remove the old password request feature when changing the password

Update the dependencies
Bump the package version
This commit is contained in:
Timothée Jaussoin 2021-07-12 11:02:08 +02:00
parent 13a1eb4dc5
commit d259a61c4f
4 changed files with 22 additions and 45 deletions

View file

@ -48,38 +48,20 @@ class PasswordController extends Controller
$algorithm = $request->has('password_sha256') ? 'SHA-256' : 'MD5';
$account->updatePassword($request->get('password'), $algorithm);
if ($account->passwords()->count() > 0) {
$request->validate(['old_password' => 'required']);
foreach ($account->passwords as $password) {
// If one of the password stored equals the one entered
if (hash_equals(
$password->password,
Utils::bchash($account->username, $account->resolvedRealm, $request->get('old_password'), $password->algorithm)
)) {
$account->updatePassword($request->get('password'), $algorithm);
$request->session()->flash('success', 'Password successfully changed');
Log::channel('events')->info('Web: Password changed', ['id' => $account->identifier]);
return redirect()->route('account.panel');
}
}
return redirect()->back()->withErrors(['old_password' => 'Old password not correct']);
Log::channel('events')->info('Web: Password changed', ['id' => $account->identifier]);
$request->session()->flash('success', 'Password successfully changed');
} else {
// No password yet
$account->updatePassword($request->get('password'), $algorithm);
Log::channel('events')->info('Web: Password set for the first time', ['id' => $account->identifier]);
$request->session()->flash('success', 'Password successfully set. Your SIP account creation process is now finished.');
if (!empty($account->email)) {
Mail::to($account)->send(new ConfirmedRegistration($account));
}
$request->session()->flash('success', 'Password successfully set. Your SIP account creation process is now finished.');
return redirect()->route('account.panel');
}
return redirect()->route('account.panel');
}
}

26
flexiapi/composer.lock generated
View file

@ -979,16 +979,16 @@
},
{
"name": "laravel/framework",
"version": "v8.49.1",
"version": "v8.49.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "62aee1bfeefd82f160c7aa3b4c63cb2f053215c0"
"reference": "d9b43ee080b4d51344b2e578aa667f85040471a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/62aee1bfeefd82f160c7aa3b4c63cb2f053215c0",
"reference": "62aee1bfeefd82f160c7aa3b4c63cb2f053215c0",
"url": "https://api.github.com/repos/laravel/framework/zipball/d9b43ee080b4d51344b2e578aa667f85040471a2",
"reference": "d9b43ee080b4d51344b2e578aa667f85040471a2",
"shasum": ""
},
"require": {
@ -1143,7 +1143,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2021-07-02T16:50:12+00:00"
"time": "2021-07-06T14:06:38+00:00"
},
{
"name": "laravel/tinker",
@ -1538,16 +1538,16 @@
},
{
"name": "monolog/monolog",
"version": "2.2.0",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084"
"reference": "df991fd88693ab703aa403413d83e15f688dae33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/1cb1cde8e8dd0f70cc0fe51354a59acad9302084",
"reference": "1cb1cde8e8dd0f70cc0fe51354a59acad9302084",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/df991fd88693ab703aa403413d83e15f688dae33",
"reference": "df991fd88693ab703aa403413d83e15f688dae33",
"shasum": ""
},
"require": {
@ -1566,7 +1566,7 @@
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
"phpspec/prophecy": "^1.6.1",
"phpstan/phpstan": "^0.12.59",
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
@ -1618,7 +1618,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.2.0"
"source": "https://github.com/Seldaek/monolog/tree/2.3.0"
},
"funding": [
{
@ -1630,7 +1630,7 @@
"type": "tidelift"
}
],
"time": "2020-12-14T13:15:25+00:00"
"time": "2021-07-05T11:34:13+00:00"
},
{
"name": "nesbot/carbon",
@ -7731,5 +7731,5 @@
"php": "^7.3"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}

View file

@ -9,12 +9,7 @@
@endif
{!! Form::open(['route' => 'account.password.update']) !!}
@if ($account->passwords()->count() > 0)
<div class="form-group">
{!! Form::label('old_password', 'Old password') !!}
{!! Form::password('old_password', ['class' => 'form-control', 'required']) !!}
</div>
@endif
<div class="form-group">
{!! Form::label('password', 'New password') !!}
{!! Form::password('password', ['class' => 'form-control', 'required']) !!}

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 86
%define build_number 87
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager