я хочу зашифровать пароль на стороне клиента и пытаюсь зашифровать пароль на стороне сервера с помощью laravel, но это не работает
Перед отправкой я зашифровал пароль в javascript на стороне клиента его на сторону сервера, как показано ниже
function encryptPassword(password, encryptionKey) {
var encryptedPassword = CryptoJS.AES.encrypt(password, encryptionKey).toString();
return encryptedPassword;
}
function encryptAndSubmit() {
var password = document.getElementById('password').value;
var encryptedKey = "used Secret_key here";
// Extract the base64 encoded part of the key
var base64Key = encryptedKey.split(":")[1];
var encryptionKey = CryptoJS.enc.Base64.parse(base64Key);
var encryptedPassword = encryptPassword(password, encryptionKey);
document.getElementById('password').value = encryptedPassword;
document.getElementById('loginForm').submit();
}
и вот как я пытался расшифровать пароль на стороне сервераpublic function authenticate(): void
{
$this->ensureIsNotRateLimited();
// Get the user by email
$user = User::where('email', $this->input('email'))->first();
// Check if the user exists and the passwords match
if ($user && password_verify($this->input('password'), $user->password)) {
// Log in the user
Auth::login($user, $this->boolean('remember'));
} else {
// Increment the rate limiter and throw validation exception
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
// Clear the rate limiter if login is successful
RateLimiter::clear($this->throttleKey());
}
Подробнее здесь: https://stackoverflow.com/questions/781 ... -laravel-o
Как зашифровать пароль в javascript (на стороне клиента) и расшифровать в laravel (на стороне сервера)? [закрыто] ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Я хочу зашифровать и расшифровать AES-GCM на языке C#, но не могу расшифровать
Anonymous » » в форуме C# - 0 Ответы
- 41 Просмотры
-
Последнее сообщение Anonymous
-