forked from baron/baron-sso
feat: remove auto-selection of affiliate by email domain and clean up UI
This commit is contained in:
@@ -45,7 +45,6 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
bool _isPhoneVerified = false;
|
bool _isPhoneVerified = false;
|
||||||
String _affiliationType = 'GENERAL';
|
String _affiliationType = 'GENERAL';
|
||||||
String? _companyCode;
|
String? _companyCode;
|
||||||
bool _isAffiliateEmail = false; // 가족사 이메일 여부
|
|
||||||
bool _termsAccepted = false;
|
bool _termsAccepted = false;
|
||||||
bool _privacyAccepted = false;
|
bool _privacyAccepted = false;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
@@ -56,7 +55,6 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
|
|
||||||
// Dynamic Tenants
|
// Dynamic Tenants
|
||||||
List<Map<String, dynamic>> _tenants = [];
|
List<Map<String, dynamic>> _tenants = [];
|
||||||
final Map<String, String> _affiliateDomains = {};
|
|
||||||
|
|
||||||
// Inline Errors
|
// Inline Errors
|
||||||
String? _emailError;
|
String? _emailError;
|
||||||
@@ -83,14 +81,6 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_tenants = tenants;
|
_tenants = tenants;
|
||||||
_affiliateDomains.clear();
|
|
||||||
for (var t in tenants) {
|
|
||||||
if (t['domains'] != null) {
|
|
||||||
for (var d in (t['domains'] as List)) {
|
|
||||||
_affiliateDomains[d.toString().toLowerCase()] = t['slug'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -125,37 +115,13 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 이메일 입력 시 도메인 체크 로직
|
// 이메일 입력 시 도메인 체크 로직 (자동 선택 제거)
|
||||||
void _checkEmailAffiliation(String email) {
|
void _checkEmailAffiliation(String email) {
|
||||||
if (!email.contains('@')) {
|
// Note: We no longer auto-set _companyCode or _affiliationType based on domain
|
||||||
if (_isAffiliateEmail) {
|
// as per user requirement (same domain can belong to different affiliates).
|
||||||
setState(() {
|
|
||||||
_isAffiliateEmail = false;
|
|
||||||
_affiliationType = 'GENERAL';
|
|
||||||
_companyCode = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final domain = email.split('@').last.toLowerCase();
|
|
||||||
if (_affiliateDomains.containsKey(domain)) {
|
|
||||||
setState(() {
|
|
||||||
_isAffiliateEmail = true;
|
|
||||||
_affiliationType = 'AFFILIATE';
|
|
||||||
_companyCode = _affiliateDomains[domain];
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (_isAffiliateEmail) {
|
|
||||||
setState(() {
|
|
||||||
_isAffiliateEmail = false;
|
|
||||||
_affiliationType = 'GENERAL';
|
|
||||||
_companyCode = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _startTimer(String type) {
|
void _startTimer(String type) {
|
||||||
if (type == 'email') {
|
if (type == 'email') {
|
||||||
_emailSeconds = 300;
|
_emailSeconds = 300;
|
||||||
@@ -1450,21 +1416,13 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
_buildProfileFieldGroup(
|
_buildProfileFieldGroup(
|
||||||
title: tr('ui.userfront.signup.profile.affiliation_type'),
|
title: tr('ui.userfront.signup.profile.affiliation_type'),
|
||||||
description: _isAffiliateEmail
|
description: '소속 유형과 회사 정보를 입력합니다.',
|
||||||
? tr('msg.userfront.signup.profile.affiliate_hint')
|
|
||||||
: '소속 유형과 회사 정보를 입력합니다.',
|
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
trailing: _isAffiliateEmail
|
trailing: null,
|
||||||
? _buildAutoDetectedBadge()
|
|
||||||
: null,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
AbsorbPointer(
|
DropdownButtonFormField<String>(
|
||||||
absorbing: _isAffiliateEmail,
|
|
||||||
child: Opacity(
|
|
||||||
opacity: _isAffiliateEmail ? 0.7 : 1.0,
|
|
||||||
child: DropdownButtonFormField<String>(
|
|
||||||
key: ValueKey(_affiliationType),
|
key: ValueKey(_affiliationType),
|
||||||
initialValue: _affiliationType,
|
initialValue: _affiliationType,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -1487,19 +1445,18 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: _isAffiliateEmail
|
onChanged: (val) {
|
||||||
? null
|
|
||||||
: (val) {
|
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_affiliationType = val;
|
_affiliationType = val;
|
||||||
|
if (_affiliationType == 'GENERAL') {
|
||||||
|
_companyCode = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
AnimatedSize(
|
AnimatedSize(
|
||||||
duration: const Duration(milliseconds: 180),
|
duration: const Duration(milliseconds: 180),
|
||||||
curve: Curves.easeOut,
|
curve: Curves.easeOut,
|
||||||
@@ -1508,11 +1465,7 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
children: [
|
children: [
|
||||||
if (_affiliationType == 'AFFILIATE') ...[
|
if (_affiliationType == 'AFFILIATE') ...[
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 14),
|
||||||
AbsorbPointer(
|
DropdownButtonFormField<String>(
|
||||||
absorbing: _isAffiliateEmail,
|
|
||||||
child: Opacity(
|
|
||||||
opacity: _isAffiliateEmail ? 0.7 : 1.0,
|
|
||||||
child: DropdownButtonFormField<String>(
|
|
||||||
key: ValueKey(_companyCode ?? 'none'),
|
key: ValueKey(_companyCode ?? 'none'),
|
||||||
initialValue: _companyCode,
|
initialValue: _companyCode,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -1527,14 +1480,10 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
child: Text(t['name'] ?? t['slug']),
|
child: Text(t['name'] ?? t['slug']),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: _isAffiliateEmail
|
onChanged: (val) => setState(
|
||||||
? null
|
|
||||||
: (val) => setState(
|
|
||||||
() => _companyCode = val,
|
() => _companyCode = val,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1577,9 +1526,7 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildProfileInfoNoticeCard({required bool isDesktop}) {
|
Widget _buildProfileInfoNoticeCard({required bool isDesktop}) {
|
||||||
final description = _isAffiliateEmail
|
const description = '회원가입 후 사용할 기본 소속 정보를 입력합니다.';
|
||||||
? '가족사 이메일이 확인되어 소속 유형이 자동으로 고정됩니다.'
|
|
||||||
: '회원가입 후 사용할 기본 소속 정보를 입력합니다.';
|
|
||||||
|
|
||||||
return DecoratedBox(
|
return DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -1679,23 +1626,6 @@ class _SignupScreenState extends State<SignupScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAutoDetectedBadge() {
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFEEF2FF),
|
|
||||||
borderRadius: BorderRadius.circular(999),
|
|
||||||
border: Border.all(color: const Color(0xFFC7D2FE)),
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'자동 선택',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 11,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF4338CA),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _buildPolicyDescription() {
|
String _buildPolicyDescription() {
|
||||||
|
|||||||
Reference in New Issue
Block a user