126 lines
5.1 KiB
PHP
126 lines
5.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../app/lib/db.php';
|
|
require_once __DIR__ . '/../app/lib/auth.php';
|
|
require_once __DIR__ . '/../app/lib/helpers.php';
|
|
|
|
if (!empty($_SESSION['user_id'])) {
|
|
header('Location: /dashboard.php');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
try {
|
|
$username = trim($_POST['username'] ?? '');
|
|
$password = trim($_POST['password'] ?? '');
|
|
$remember = !empty($_POST['remember']);
|
|
|
|
if ($username === '' || $password === '') {
|
|
throw new RuntimeException('아이디와 비밀번호를 입력하세요.');
|
|
}
|
|
|
|
throttle_login_attempts($username);
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ? LIMIT 1");
|
|
$stmt->execute([$username]);
|
|
$user = $stmt->fetch();
|
|
|
|
if (!$user || !password_verify($password, $user['password_hash'])) {
|
|
throw new RuntimeException('로그인 정보가 올바르지 않습니다.');
|
|
}
|
|
|
|
clear_login_attempts($username);
|
|
login_user($user, $remember);
|
|
header('Location: /dashboard.php');
|
|
exit;
|
|
} catch (Throwable $e) {
|
|
$error = $e->getMessage();
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Financial | 개인 자산관리 · 가계부 · 대출 · 할부 통합 관리</title>
|
|
|
|
<meta name="description" content="수입·지출 가계부, 계좌·카드 관리, 대출 상환 일정, 카드 할부 청구, 자동 분류 규칙까지 한 번에 관리하는 개인 금융 통합 서비스 Financial.">
|
|
|
|
<meta name="keywords" content="가계부, 자산관리, 개인재무, 대출관리, 할부관리, 카드관리, 수입지출, 금융관리, Financial">
|
|
|
|
<meta name="author" content="Financial">
|
|
<meta name="robots" content="index,follow">
|
|
<meta name="theme-color" content="#0b2a66">
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-title" content="Financial">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
|
|
<link rel="icon" type="image/png" href="/favicon.png?v=2">
|
|
<link rel="shortcut icon" href="/favicon.png?v=2">
|
|
<link rel="apple-touch-icon" href="/favicon.png?v=2">
|
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:site_name" content="Financial">
|
|
<meta property="og:title" content="Financial | 개인 자산관리 · 가계부 · 대출 · 할부 통합 관리">
|
|
<meta property="og:description" content="계좌, 카드, 가계부, 대출, 할부를 한 곳에서 쉽고 체계적으로 관리하세요.">
|
|
<meta property="og:image" content="https://seo.chaegeon.com/favicon.png">
|
|
<meta property="og:url" content="https://seo.chaegeon.com/">
|
|
|
|
<meta name="twitter:card" content="summary">
|
|
<meta name="twitter:title" content="Financial">
|
|
<meta name="twitter:description" content="개인 금융 통합 관리 서비스">
|
|
<meta name="twitter:image" content="https://seo.chaegeon.com/favicon.png">
|
|
|
|
<link href="/assets/vendor/bootstrap.min.css" rel="stylesheet">
|
|
<link href="/assets/app.css" rel="stylesheet">
|
|
<script src="https://chaegeon.com/log/bancheck.min.js?_=<?php echo time(); ?>"></script>
|
|
</head>
|
|
<body>
|
|
<div class="container py-5" style="max-width: 460px;">
|
|
<div class="card finance-card">
|
|
<div class="card-body p-4">
|
|
<h2 class="mb-4">로그인</h2>
|
|
|
|
<?php if ($error): ?>
|
|
<div class="alert alert-danger"><?= h($error) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<form method="post" class="row g-3">
|
|
<div class="col-12">
|
|
<label class="form-label">아이디</label>
|
|
<input type="text" name="username" class="form-control" required>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label class="form-label">비밀번호</label>
|
|
<input type="password" name="password" class="form-control" required>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="remember" id="remember" value="1">
|
|
<label class="form-check-label" for="remember">자동로그인</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<button class="btn btn-primary w-100">로그인</button>
|
|
</div>
|
|
|
|
<div class="col-12 text-center">
|
|
<a href="/register.php" class="text-decoration-none">PIN 코드로 회원가입</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="https://chaegeon.com/log/logger.js"></script>
|
|
<script src="/assets/pwa.js"></script>
|
|
</body>
|
|
</html>
|