Skip to content

Commit

Permalink
account sniff matches both get and post
Browse files Browse the repository at this point in the history
  • Loading branch information
sushmashivakavi committed Oct 5, 2023
1 parent 7b4f963 commit 0e2f882
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'prefix' => $prefix,
'as' => $as
], function (): void {
Route::post('account/sniff', 'Account\Controller@sniff');
Route::match(['get', 'post'],'account/sniff/{id?}', 'Account\Controller@sniff');

Route::get('activate', 'Auth\ActivationController@activate')->name('user.activate');
Route::any('logout', 'Auth\LoginController@logout')->name('logout');
Expand Down
7 changes: 5 additions & 2 deletions src/Http/Controllers/Account/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,16 @@ public function password(): array
];
}

public function sniff()
public function sniff(string $key = null)
{
$decrypted = null;
session()->forget('sniffed');
session()->forget('sniff');

$key = $this->post("key");
if($this->isMethod('post')){
$key = $this->post("key");
}

try {
$decrypted = decrypt($key);
} catch (DecryptException $e) {
Expand Down

0 comments on commit 0e2f882

Please sign in to comment.