mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Client Contact password reset links
This commit is contained in:
parent
0fe892a292
commit
b91af0dc69
@ -76,7 +76,7 @@ class ContactForgotPasswordController extends Controller
|
|||||||
|
|
||||||
public function sendResetLinkEmail(ContactPasswordResetRequest $request)
|
public function sendResetLinkEmail(ContactPasswordResetRequest $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$user = MultiDB::hasContact($request->input('email'));
|
$user = MultiDB::hasContact($request->input('email'));
|
||||||
|
|
||||||
$this->validateEmail($request);
|
$this->validateEmail($request);
|
||||||
|
@ -71,6 +71,31 @@ class ContactResetPasswordController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function reset(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate($this->rules(), $this->validationErrorMessages());
|
||||||
|
|
||||||
|
// Here we will attempt to reset the user's password. If it is successful we
|
||||||
|
// will update the password on an actual user model and persist it to the
|
||||||
|
// database. Otherwise we will parse the error and return the response.
|
||||||
|
$response = $this->broker()->reset(
|
||||||
|
$this->credentials($request), function ($user, $password) {
|
||||||
|
$this->resetPassword($user, $password);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Added this because it collides the session between
|
||||||
|
// client & main portal giving unlimited redirects.
|
||||||
|
auth()->logout();
|
||||||
|
|
||||||
|
// If the password was successfully reset, we will redirect the user back to
|
||||||
|
// the application's home authenticated view. If there is an error we can
|
||||||
|
// redirect them back to where they came from with their error message.
|
||||||
|
return $response == Password::PASSWORD_RESET
|
||||||
|
? $this->sendResetResponse($request, $response)
|
||||||
|
: $this->sendResetFailedResponse($request, $response);
|
||||||
|
}
|
||||||
|
|
||||||
protected function guard()
|
protected function guard()
|
||||||
{
|
{
|
||||||
return Auth::guard('contact');
|
return Auth::guard('contact');
|
||||||
|
@ -198,6 +198,10 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
|||||||
|
|
||||||
public function sendPasswordResetNotification($token)
|
public function sendPasswordResetNotification($token)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->token = $token;
|
||||||
|
$this->save();
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer((new ClientContactResetPasswordObject($token, $this))->build());
|
$nmo->mailable = new NinjaMailer((new ClientContactResetPasswordObject($token, $this))->build());
|
||||||
$nmo->to_user = $this;
|
$nmo->to_user = $this;
|
||||||
|
@ -299,8 +299,8 @@ class BaseRepository
|
|||||||
if((int)$model->balance != 0 && $model->partial > $model->amount)
|
if((int)$model->balance != 0 && $model->partial > $model->amount)
|
||||||
$model->partial = min($model->amount, $model->balance);
|
$model->partial = min($model->amount, $model->balance);
|
||||||
|
|
||||||
/* Update product details if necessary */
|
/* Update product details if necessary - if we are inside a transaction - do nothing */
|
||||||
if ($model->company->update_products && $model->id)
|
if ($model->company->update_products && $model->id && \DB::transactionLevel() == 0)
|
||||||
UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company);
|
UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company);
|
||||||
|
|
||||||
/* Perform model specific tasks */
|
/* Perform model specific tasks */
|
||||||
|
Loading…
Reference in New Issue
Block a user