Compare commits
2 commits
844097ecf0
...
efe979768c
| Author | SHA1 | Date | |
|---|---|---|---|
| efe979768c | |||
| 8167c3a3e7 |
4 changed files with 3 additions and 15 deletions
|
|
@ -24,8 +24,9 @@ class AddContentSecurityPolicy
|
||||||
"style-src 'self' 'unsafe-inline' http: https:; " .
|
"style-src 'self' 'unsafe-inline' http: https:; " .
|
||||||
"connect-src 'self' ws: http: https:;";
|
"connect-src 'self' ws: http: https:;";
|
||||||
} else {
|
} else {
|
||||||
// Production CSP - Livewire v3 requires unsafe-eval
|
// Production CSP - Livewire v3 requires unsafe-eval and nonce for inline scripts
|
||||||
$csp = "script-src 'self' 'unsafe-eval' https:; " .
|
$nonce = csp_nonce();
|
||||||
|
$csp = "script-src 'self' 'unsafe-eval' 'nonce-{$nonce}' https:; " .
|
||||||
"style-src 'self' 'unsafe-inline' https:; " .
|
"style-src 'self' 'unsafe-inline' https:; " .
|
||||||
"connect-src 'self' https:;";
|
"connect-src 'self' https:;";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,8 @@ class PasswordReset extends Component
|
||||||
#[Layout('components.layouts.auth')]
|
#[Layout('components.layouts.auth')]
|
||||||
public function resetPassword()
|
public function resetPassword()
|
||||||
{
|
{
|
||||||
logger()->info("Validating password reset...");
|
|
||||||
logger()->info($this->form);
|
|
||||||
$validated = $this->form->validate();
|
$validated = $this->form->validate();
|
||||||
|
|
||||||
logger()->info("Validated password reset", $validated);
|
|
||||||
|
|
||||||
$status = Password::reset(array_merge($validated, ['token' => $this->token]),
|
$status = Password::reset(array_merge($validated, ['token' => $this->token]),
|
||||||
function (User $user, string $password) {
|
function (User $user, string $password) {
|
||||||
$user->forceFill([
|
$user->forceFill([
|
||||||
|
|
@ -47,7 +43,6 @@ class PasswordReset extends Component
|
||||||
return redirect()->route('login');
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger()->error("Password reset failed", $status);
|
|
||||||
$this->addError('email', 'The provided credentials do not match our records.');
|
$this->addError('email', 'The provided credentials do not match our records.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,10 @@ class RegisterUser extends Component
|
||||||
|
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
logger()->info("Validating...");
|
|
||||||
logger()->info($this->form->toArray());
|
|
||||||
$validated = $this->form->validate();
|
|
||||||
|
|
||||||
logger()->info("Validated", $validated);
|
|
||||||
$user = User::create($this->form->all());
|
$user = User::create($this->form->all());
|
||||||
UserProfile::create(["user_id" => $user->id]);
|
UserProfile::create(["user_id" => $user->id]);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new PasswordResetNewUser($user));
|
Mail::to($user->email)->send(new PasswordResetNewUser($user));
|
||||||
logger()->info("New user registered: " . $user->email);
|
|
||||||
return redirect()->route('login');
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@ class PasswordResetNewUser extends Mailable
|
||||||
*/
|
*/
|
||||||
public function __construct(private User $user)
|
public function __construct(private User $user)
|
||||||
{
|
{
|
||||||
logger()->debug("\n==============================\n User email is $user->email. Username is $user->username \n=====================================");
|
|
||||||
$this->token = Password::createToken($this->user);
|
$this->token = Password::createToken($this->user);
|
||||||
logger()->debug("Password reset token is $this->token");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue