Skip to content

Commit

Permalink
Add a route for removing the password
Browse files Browse the repository at this point in the history
  • Loading branch information
m1guelpf committed Aug 17, 2019
1 parent a8e3a14 commit 9365065
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/Http/Controllers/OrgController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ public function password(Org $org)
$org->update(['password' => Hash::make(request('password'))]);
});
}

public function removePassword(Org $org)
{
$this->authorize('update', $org);
$org->password = bcrypt($request->input('org_passwd'));
$org->save();

return redirect('org/'.$org->id)->withSuccess('The organization password was successfully updated.');
return tap($org, function($org) {
$org->update(['password' => null]);
});
}

public function update(Org $org)
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Route::get('dashboard', 'DashboardController@index')->name('dashboard');
Route::get('org/{org}', 'OrgController@index')->name('org');
Route::post('org/{org}/password', 'OrgController@password')->name('org.password');
Route::delete('org/{org}/password', 'OrgController@removePassword')->name('org.password');
Route::put('org/{org}', 'OrgController@update')->name('org.update');
Route::delete('org/{org}', 'OrgController@delete')->name('org.delete');
Route::post('org/{org}/message', 'OrgController@message')->name('org.message');
Expand Down

0 comments on commit 9365065

Please sign in to comment.