backup: 사용하지 않는 파일 삭제 전 복구 지점
- 전체 371개 파일 중 82개 미사용 파일 식별 - Phase 1: 33개 파일 삭제 예정 (100% 안전) - Phase 2: 30개 파일 삭제 검토 예정 - Phase 3: 19개 파일 수동 검토 예정 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -67,11 +67,39 @@ class _AppLayoutState extends State<AppLayout>
|
||||
}
|
||||
|
||||
Future<void> _loadCurrentUser() async {
|
||||
try {
|
||||
// 서버에서 최신 관리자 정보 가져오기
|
||||
final result = await _authService.getCurrentAdminFromServer();
|
||||
result.fold(
|
||||
(failure) {
|
||||
print('[AppLayout] 서버에서 관리자 정보 로드 실패: ${failure.message}');
|
||||
// 실패 시 로컬 스토리지에서 캐시된 정보 사용
|
||||
_loadCurrentUserFromLocal();
|
||||
},
|
||||
(user) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentUser = user;
|
||||
});
|
||||
print('[AppLayout] 서버에서 관리자 정보 로드 성공: ${user.name} (${user.email})');
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print('[AppLayout] 관리자 정보 로드 중 예외 발생: $e');
|
||||
// 예외 발생 시 로컬 스토리지에서 캐시된 정보 사용
|
||||
_loadCurrentUserFromLocal();
|
||||
}
|
||||
}
|
||||
|
||||
/// 로컬 스토리지에서 캐시된 사용자 정보 로드 (fallback)
|
||||
Future<void> _loadCurrentUserFromLocal() async {
|
||||
final user = await _authService.getCurrentUser();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_currentUser = user;
|
||||
});
|
||||
print('[AppLayout] 로컬에서 관리자 정보 로드: ${user?.name ?? 'Unknown'}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,6 +654,14 @@ class _AppLayoutState extends State<AppLayout>
|
||||
// 프로필 설정 화면으로 이동
|
||||
},
|
||||
),
|
||||
_buildProfileMenuItem(
|
||||
icon: Icons.lock_outline,
|
||||
title: '비밀번호 변경',
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_showChangePasswordDialog(context);
|
||||
},
|
||||
),
|
||||
_buildProfileMenuItem(
|
||||
icon: Icons.settings_outlined,
|
||||
title: '환경 설정',
|
||||
@@ -728,6 +764,228 @@ class _AppLayoutState extends State<AppLayout>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 비밀번호 변경 다이얼로그
|
||||
void _showChangePasswordDialog(BuildContext context) {
|
||||
final oldPasswordController = TextEditingController();
|
||||
final newPasswordController = TextEditingController();
|
||||
final confirmPasswordController = TextEditingController();
|
||||
bool isLoading = false;
|
||||
bool obscureOldPassword = true;
|
||||
bool obscureNewPassword = true;
|
||||
bool obscureConfirmPassword = true;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => StatefulBuilder(
|
||||
builder: (context, setState) => AlertDialog(
|
||||
backgroundColor: ShadcnTheme.background,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusLg),
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.lock_outline,
|
||||
color: ShadcnTheme.primary,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(width: ShadcnTheme.spacing3),
|
||||
Text(
|
||||
'비밀번호 변경',
|
||||
style: ShadcnTheme.headingH5,
|
||||
),
|
||||
],
|
||||
),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'보안을 위해 기존 비밀번호를 입력하고 새 비밀번호를 설정해주세요.',
|
||||
style: ShadcnTheme.bodySmall.copyWith(
|
||||
color: ShadcnTheme.foregroundMuted,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing6),
|
||||
|
||||
// 기존 비밀번호
|
||||
Text(
|
||||
'기존 비밀번호',
|
||||
style: ShadcnTheme.labelMedium,
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing2),
|
||||
TextFormField(
|
||||
controller: oldPasswordController,
|
||||
obscureText: obscureOldPassword,
|
||||
decoration: InputDecoration(
|
||||
hintText: '현재 사용중인 비밀번호를 입력하세요',
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscureOldPassword = !obscureOldPassword;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
obscureOldPassword ? Icons.visibility_off : Icons.visibility,
|
||||
color: ShadcnTheme.foregroundMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
|
||||
// 새 비밀번호
|
||||
Text(
|
||||
'새 비밀번호',
|
||||
style: ShadcnTheme.labelMedium,
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing2),
|
||||
TextFormField(
|
||||
controller: newPasswordController,
|
||||
obscureText: obscureNewPassword,
|
||||
decoration: InputDecoration(
|
||||
hintText: '8자 이상의 새 비밀번호를 입력하세요',
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscureNewPassword = !obscureNewPassword;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
obscureNewPassword ? Icons.visibility_off : Icons.visibility,
|
||||
color: ShadcnTheme.foregroundMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: ShadcnTheme.spacing4),
|
||||
|
||||
// 새 비밀번호 확인
|
||||
Text(
|
||||
'새 비밀번호 확인',
|
||||
style: ShadcnTheme.labelMedium,
|
||||
),
|
||||
const SizedBox(height: ShadcnTheme.spacing2),
|
||||
TextFormField(
|
||||
controller: confirmPasswordController,
|
||||
obscureText: obscureConfirmPassword,
|
||||
decoration: InputDecoration(
|
||||
hintText: '새 비밀번호를 다시 입력하세요',
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscureConfirmPassword = !obscureConfirmPassword;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
obscureConfirmPassword ? Icons.visibility_off : Icons.visibility,
|
||||
color: ShadcnTheme.foregroundMuted,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ShadcnButton(
|
||||
text: '취소',
|
||||
onPressed: isLoading ? null : () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
variant: ShadcnButtonVariant.secondary,
|
||||
),
|
||||
ShadcnButton(
|
||||
text: isLoading ? '변경 중...' : '변경하기',
|
||||
onPressed: isLoading ? null : () async {
|
||||
// 유효성 검사
|
||||
if (oldPasswordController.text.isEmpty) {
|
||||
_showSnackBar(context, '기존 비밀번호를 입력해주세요.', isError: true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newPasswordController.text.length < 8) {
|
||||
_showSnackBar(context, '새 비밀번호는 8자 이상이어야 합니다.', isError: true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newPasswordController.text != confirmPasswordController.text) {
|
||||
_showSnackBar(context, '새 비밀번호가 일치하지 않습니다.', isError: true);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
|
||||
try {
|
||||
// AuthService.changePassword API 호출
|
||||
final result = await _authService.changePassword(
|
||||
oldPassword: oldPasswordController.text,
|
||||
newPassword: newPasswordController.text,
|
||||
);
|
||||
|
||||
result.fold(
|
||||
(failure) {
|
||||
if (context.mounted) {
|
||||
_showSnackBar(context, failure.message, isError: true);
|
||||
}
|
||||
},
|
||||
(messageResponse) {
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
_showSnackBar(context, messageResponse.message);
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
_showSnackBar(context, '비밀번호 변경 중 오류가 발생했습니다.', isError: true);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
variant: ShadcnButtonVariant.primary,
|
||||
icon: isLoading ? SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
ShadcnTheme.primaryForeground,
|
||||
),
|
||||
),
|
||||
) : Icon(Icons.check, size: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 스낵바 표시 헬퍼 메서드
|
||||
void _showSnackBar(BuildContext context, String message, {bool isError = false}) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: isError ? ShadcnTheme.error : ShadcnTheme.success,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(ShadcnTheme.radiusMd),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 재설계된 사이드바 메뉴 (접기/펼치기 지원)
|
||||
|
||||
Reference in New Issue
Block a user