feat(user): 사용자 자기정보 편집과 관리자 재설정 플로우를 연동

- lib/widgets/app_shell.dart에서 내 정보 다이얼로그를 추가하고 UserRepository.updateMe·비밀번호 변경 로직을 연결

- lib/features/masters/user/* 모듈에 phone·forcePasswordChange·passwordUpdatedAt 필드를 반영하고 reset-password/update-me API를 사용

- lib/core/validation/password_rules.dart을 신설해 비밀번호 정책 검증을 공통화하고 신규 위젯·테스트에서 재사용

- doc/stock_approval_system_api_v4.md 등 문서를 users 스펙 개편 내용으로 갱신하고 user_management_plan.md를 추가

- test/widgets/app_shell_test.dart 등에서 자기정보 수정·비밀번호 재설정 시나리오를 검증하고 기존 테스트를 보강
This commit is contained in:
JiWoong Sul
2025-10-26 17:05:47 +09:00
parent 9beb161527
commit 14624c4165
23 changed files with 1958 additions and 194 deletions

View File

@@ -3,6 +3,7 @@ import 'package:flutter/foundation.dart';
import '../../../core/network/interceptors/auth_interceptor.dart';
import '../../../core/services/token_storage.dart';
import '../domain/entities/auth_session.dart';
import '../domain/entities/authenticated_user.dart';
import '../domain/entities/login_request.dart';
import '../domain/repositories/auth_repository.dart';
@@ -69,6 +70,22 @@ class AuthService extends ChangeNotifier {
}
}
/// 현재 세션의 사용자 정보를 갱신한다.
void updateSessionUser(AuthenticatedUser user) {
final current = _session;
if (current == null) {
return;
}
_session = AuthSession(
accessToken: current.accessToken,
refreshToken: current.refreshToken,
expiresAt: current.expiresAt,
user: user,
permissions: current.permissions,
);
notifyListeners();
}
Future<void> _persistSession(AuthSession session) async {
_session = session;
await _tokenStorage.writeAccessToken(session.accessToken);

View File

@@ -96,6 +96,7 @@ AuthenticatedUser _parseUser(Map<String, dynamic> json) {
final name = _readString(json, 'name') ?? '';
final employeeNo = _readString(json, 'employee_no');
final email = _readString(json, 'email');
final phone = _readString(json, 'phone');
final group = JsonUtils.extractMap(
json,
keys: const ['group', 'primary_group'],
@@ -105,6 +106,7 @@ AuthenticatedUser _parseUser(Map<String, dynamic> json) {
name: name,
employeeNo: employeeNo,
email: email,
phone: phone,
primaryGroupId: _readOptionalInt(group, 'id'),
primaryGroupName: _readString(group, 'name'),
);

View File

@@ -5,6 +5,7 @@ class AuthenticatedUser {
required this.name,
this.employeeNo,
this.email,
this.phone,
this.primaryGroupId,
this.primaryGroupName,
});
@@ -21,9 +22,31 @@ class AuthenticatedUser {
/// 이메일
final String? email;
/// 연락처
final String? phone;
/// 기본 소속 그룹 ID
final int? primaryGroupId;
/// 기본 소속 그룹명
final String? primaryGroupName;
AuthenticatedUser copyWith({
String? name,
String? employeeNo,
String? email,
String? phone,
int? primaryGroupId,
String? primaryGroupName,
}) {
return AuthenticatedUser(
id: id,
name: name ?? this.name,
employeeNo: employeeNo ?? this.employeeNo,
email: email ?? this.email,
phone: phone ?? this.phone,
primaryGroupId: primaryGroupId ?? this.primaryGroupId,
primaryGroupName: primaryGroupName ?? this.primaryGroupName,
);
}
}