This commit is contained in:
antv
2026-07-02 17:02:02 +07:00
parent 89790539b7
commit f594a45e84
17 changed files with 200 additions and 122 deletions
+4 -2
View File
@@ -66,8 +66,10 @@ class AdminService implements AdminServiceInterface
{
User::create([
'msnv' => $data['msnv'],
'name' => $data['name'],
'mail' => $data['mail'],
'pass' => Hash::make($data['password']),
'departments' => $data['departments'],
'role' => $data['role'],
'status' => User::STATUS_ACTIVE,
'card' => 0,
@@ -83,9 +85,9 @@ class AdminService implements AdminServiceInterface
DB::transaction(function () use ($data, $user) {
if (!empty($data['num_card'])) {
AddCard::create([
'buyer' => abs(crc32($user->msnv)) % 1000000,
'buyer' => $user->msnv,
'num_card' => $data['num_card'],
'seller' => abs(crc32(Auth::user()->msnv)) % 1000000,
'seller' => Auth::user()->msnv,
'date' => Carbon::today(),
]);
$user->card += $data['num_card'];
+5 -4
View File
@@ -11,14 +11,15 @@ class AuthService implements AuthServiceInterface
{
public function attemptLogin(array $credentials, Request $request): array
{
if (!Auth::attempt(['mail' => $credentials['mail'], 'password' => $credentials['password']])) {
// Manual MD5 password check
$user = User::where('mail', $credentials['mail'])->first();
if (!$user || $user->pass !== md5($credentials['password'])) {
return ['success' => false, 'error_key' => 'mail', 'error_msg' => __('auth.failed')];
}
// Log the user in manually
Auth::login($user);
$request->session()->regenerate();
$user = Auth::user();
if ($user->status != User::STATUS_ACTIVE) {
Auth::logout();
return ['success' => false, 'error_key' => 'mail', 'error_msg' => __('auth.inactive')];
+5
View File
@@ -38,6 +38,11 @@ class UserService implements UserServiceInterface
throw new \RuntimeException(__('messages.error.no_send_permission'));
}
$receiver = User::where('msnv', $receiverMsnv)->first();
if (!$receiver || $receiver->status != User::STATUS_ACTIVE) {
throw new \RuntimeException(__('messages.error.receiver_invalid'));
}
$startOfMonth = Carbon::now()->startOfMonth();
$endOfMonth = Carbon::now()->endOfMonth();