forked from baron/baron-sso
비밀번호 로그인 +82 후처리 추가
This commit is contained in:
@@ -108,12 +108,28 @@ class _CreateUserScreenState extends State<CreateUserScreen> {
|
|||||||
|
|
||||||
setState(() => _isLoading = true);
|
setState(() => _isLoading = true);
|
||||||
|
|
||||||
|
String loginId = _loginIdController.text.trim();
|
||||||
|
if (!loginId.contains('@')) {
|
||||||
|
loginId = loginId.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (loginId.startsWith('010')) {
|
||||||
|
loginId = '+82${loginId.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String? phone = _phoneController.text.trim().isEmpty ? null : _phoneController.text.trim();
|
||||||
|
if (phone != null && !phone.contains('@')) {
|
||||||
|
phone = phone.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (phone.startsWith('010')) {
|
||||||
|
phone = '+82${phone.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await AuthProxyService.createUser(
|
await AuthProxyService.createUser(
|
||||||
loginId: _loginIdController.text.trim(),
|
loginId: loginId,
|
||||||
adminPassword: _verifiedAdminPassword!,
|
adminPassword: _verifiedAdminPassword!,
|
||||||
email: _emailController.text.trim().isEmpty ? null : _emailController.text.trim(),
|
email: _emailController.text.trim().isEmpty ? null : _emailController.text.trim(),
|
||||||
phone: _phoneController.text.trim().isEmpty ? null : _phoneController.text.trim(),
|
phone: phone,
|
||||||
displayName: _nameController.text.trim().isEmpty ? null : _nameController.text.trim(),
|
displayName: _nameController.text.trim().isEmpty ? null : _nameController.text.trim(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -205,13 +205,22 @@ class _UserManagementScreenState extends State<UserManagementScreen> with Single
|
|||||||
if (confirm != true) return;
|
if (confirm != true) return;
|
||||||
|
|
||||||
setState(() => _isLoading = true);
|
setState(() => _isLoading = true);
|
||||||
|
|
||||||
|
String? phone = phoneController.text.trim().isEmpty ? null : phoneController.text.trim();
|
||||||
|
if (phone != null && !phone.contains('@')) {
|
||||||
|
phone = phone.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (phone.startsWith('010')) {
|
||||||
|
phone = '+82${phone.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await AuthProxyService.updateUserDetails(
|
await AuthProxyService.updateUserDetails(
|
||||||
adminPassword: _verifiedAdminPassword!,
|
adminPassword: _verifiedAdminPassword!,
|
||||||
loginId: loginId,
|
loginId: loginId,
|
||||||
displayName: nameController.text.trim(),
|
displayName: nameController.text.trim(),
|
||||||
email: emailController.text.trim(),
|
email: emailController.text.trim(),
|
||||||
phone: phoneController.text.trim(),
|
phone: phone,
|
||||||
);
|
);
|
||||||
_showSuccess("User updated successfully");
|
_showSuccess("User updated successfully");
|
||||||
_loadUsers(query: _searchController.text);
|
_loadUsers(query: _searchController.text);
|
||||||
@@ -228,12 +237,29 @@ class _UserManagementScreenState extends State<UserManagementScreen> with Single
|
|||||||
if (_verifiedAdminPassword == null) return;
|
if (_verifiedAdminPassword == null) return;
|
||||||
|
|
||||||
setState(() => _isLoading = true);
|
setState(() => _isLoading = true);
|
||||||
|
|
||||||
|
String loginId = _createLoginIdController.text.trim();
|
||||||
|
if (!loginId.contains('@')) {
|
||||||
|
loginId = loginId.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (loginId.startsWith('010')) {
|
||||||
|
loginId = '+82${loginId.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String? phone = _createPhoneController.text.trim().isEmpty ? null : _createPhoneController.text.trim();
|
||||||
|
if (phone != null && !phone.contains('@')) {
|
||||||
|
phone = phone.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (phone.startsWith('010')) {
|
||||||
|
phone = '+82${phone.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await AuthProxyService.createUser(
|
await AuthProxyService.createUser(
|
||||||
loginId: _createLoginIdController.text.trim(),
|
loginId: loginId,
|
||||||
adminPassword: _verifiedAdminPassword!,
|
adminPassword: _verifiedAdminPassword!,
|
||||||
email: _createEmailController.text.trim().isEmpty ? null : _createEmailController.text.trim(),
|
email: _createEmailController.text.trim().isEmpty ? null : _createEmailController.text.trim(),
|
||||||
phone: _createPhoneController.text.trim().isEmpty ? null : _createPhoneController.text.trim(),
|
phone: phone,
|
||||||
displayName: _createNameController.text.trim().isEmpty ? null : _createNameController.text.trim(),
|
displayName: _createNameController.text.trim().isEmpty ? null : _createNameController.text.trim(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,25 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
Future<void> _handlePasswordReset() async {
|
Future<void> _handlePasswordReset() async {
|
||||||
if (_loginIdController.text.trim().isEmpty) {
|
final input = _loginIdController.text.trim();
|
||||||
|
if (input.isEmpty) {
|
||||||
_showError("이메일 또는 휴대폰 번호를 입력해주세요.");
|
_showError("이메일 또는 휴대폰 번호를 입력해주세요.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String loginId = input;
|
||||||
|
if (!input.contains('@')) {
|
||||||
|
// Format phone number if it's not an email
|
||||||
|
loginId = input.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (loginId.startsWith('010')) {
|
||||||
|
loginId = '+82${loginId.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setState(() => _isLoading = true);
|
setState(() => _isLoading = true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await AuthProxyService.initiatePasswordReset(_loginIdController.text.trim());
|
await AuthProxyService.initiatePasswordReset(loginId);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
|
|||||||
@@ -245,13 +245,22 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
|||||||
|
|
||||||
// 이메일/비밀번호 로그인 처리
|
// 이메일/비밀번호 로그인 처리
|
||||||
Future<void> _handlePasswordLogin() async {
|
Future<void> _handlePasswordLogin() async {
|
||||||
final loginId = _passwordLoginIdController.text.trim();
|
final input = _passwordLoginIdController.text.trim();
|
||||||
final password = _passwordController.text.trim();
|
final password = _passwordController.text.trim();
|
||||||
if (loginId.isEmpty || password.isEmpty) {
|
if (input.isEmpty || password.isEmpty) {
|
||||||
_showError("이메일(또는 전화번호)와 비밀번호를 모두 입력해주세요.");
|
_showError("이메일(또는 전화번호)와 비밀번호를 모두 입력해주세요.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String loginId = input;
|
||||||
|
if (!input.contains('@')) {
|
||||||
|
// Format phone number if it's not an email
|
||||||
|
loginId = input.replaceAll(RegExp(r'[-\s]'), '');
|
||||||
|
if (loginId.startsWith('010')) {
|
||||||
|
loginId = '+82${loginId.substring(1)}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 로딩 인디케이터 표시
|
// 로딩 인디케이터 표시
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
Reference in New Issue
Block a user