mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for reset password
This commit is contained in:
parent
daff65de01
commit
8a582f7800
@ -105,6 +105,9 @@ class CreateAccount extends Command
|
||||
'password' => Hash::make($password),
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
'email_verified_at' => now(),
|
||||
'first_name' => 'New',
|
||||
'last_name' => 'User',
|
||||
'phone' => '',
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
|
@ -169,4 +169,27 @@ abstract class QueryFilters
|
||||
|
||||
return $this->builder->where('created_at', '>=', $created_at);
|
||||
}
|
||||
|
||||
public function is_deleted($value)
|
||||
{
|
||||
|
||||
return $this->builder->where('is_deleted', $value);
|
||||
|
||||
}
|
||||
|
||||
public function filter_deleted_clients($value)
|
||||
{
|
||||
|
||||
if($value == 'true'){
|
||||
|
||||
return $this->builder->whereHas('client', function (Builder $query) {
|
||||
|
||||
$query->where('is_deleted', 0);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return $this->builder;
|
||||
}
|
||||
}
|
||||
|
@ -104,9 +104,9 @@ class ForgotPasswordController extends Controller
|
||||
*/
|
||||
public function sendResetLinkEmail(Request $request)
|
||||
{
|
||||
MultiDB::userFindAndSetDb($request->input('email'));
|
||||
// MultiDB::userFindAndSetDb($request->input('email'));
|
||||
|
||||
$user = MultiDB::hasUser(['email' => $request->input('email')]);
|
||||
// $user = MultiDB::hasUser(['email' => $request->input('email')]);
|
||||
|
||||
$this->validateEmail($request);
|
||||
|
||||
@ -115,9 +115,13 @@ class ForgotPasswordController extends Controller
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
$response = $this->broker()->sendResetLink(
|
||||
$this->credentials($request)
|
||||
);
|
||||
nlog($response);
|
||||
);
|
||||
|
||||
if ($request->ajax()) {
|
||||
|
||||
if($response == Password::RESET_THROTTLED)
|
||||
return response()->json(['message' => ctrans('passwords.throttled'), 'status' => false], 429);
|
||||
|
||||
return $response == Password::RESET_LINK_SENT
|
||||
? response()->json(['message' => 'Reset link sent to your email.', 'status' => true], 201)
|
||||
: response()->json(['message' => 'Email not found', 'status' => false], 401);
|
||||
|
@ -34,12 +34,9 @@ class SetEmailDb
|
||||
|
||||
if ($request->input('email') && config('ninja.db.multi_db_enabled')) {
|
||||
|
||||
nlog("finding email = ". $request->input('email'));
|
||||
|
||||
if (! MultiDB::userFindAndSetDb($request->input('email')))
|
||||
return response()->json($error, 400);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -457,13 +457,13 @@ class CompanyExport implements ShouldQueue
|
||||
|
||||
fclose($tempStream);
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new DownloadBackup(Storage::disk(config('filesystems.default'))->url($path.$file_name), $this->company);
|
||||
$nmo->to_user = $this->user;
|
||||
$nmo->settings = $this->company->settings;
|
||||
$nmo->company = $this->company;
|
||||
// $nmo = new NinjaMailerObject;
|
||||
// $nmo->mailable = new DownloadBackup(Storage::disk(config('filesystems.default'))->url($path.$file_name), $this->company);
|
||||
// $nmo->to_user = $this->user;
|
||||
// $nmo->settings = $this->company->settings;
|
||||
// $nmo->company = $this->company;
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
// NinjaMailerJob::dispatch($nmo);
|
||||
|
||||
UnlinkFile::dispatch(config('filesystems.default'), $path.$file_name)->delay(now()->addHours(1));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ Route::group(['middleware' => ['api_secret_check']], function () {
|
||||
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['api_secret_check']], function () {
|
||||
Route::group(['middleware' => ['api_secret_check','email_db']], function () {
|
||||
Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit');
|
||||
Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail');
|
||||
});
|
||||
|
@ -45,5 +45,7 @@ class ExportCompanyTest extends TestCase
|
||||
public function testCompanyExport()
|
||||
{
|
||||
CompanyExport::dispatchNow($this->company, $this->company->users->first());
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user