로그인을 Figma 2단계(로그인 → 간편 로그인)로 · 회원가입 · 약관 동의 · 가입 완료 화면
This commit is contained in:
@@ -83,7 +83,10 @@ final class GoogleSignInProvider
|
||||
}
|
||||
return AuthFailed('E-AUTH-03', error.description ?? error.code.name);
|
||||
} on fb.FirebaseAuthException catch (error) {
|
||||
return AuthFailed(authCatalogCode(error), authMessage(error, flow: AuthFlow.signIn));
|
||||
return AuthFailed(
|
||||
authCatalogCode(error),
|
||||
authMessage(error, flow: AuthFlow.signIn),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +182,10 @@ final class AppleSignInProvider
|
||||
debugPrint('[AppleSignInProvider] failed: ${error.runtimeType}');
|
||||
return const AuthFailed('E-AUTH-03', '소셜 로그인에 실패했습니다.');
|
||||
} on fb.FirebaseAuthException catch (error) {
|
||||
return AuthFailed(authCatalogCode(error), authMessage(error, flow: AuthFlow.signIn));
|
||||
return AuthFailed(
|
||||
authCatalogCode(error),
|
||||
authMessage(error, flow: AuthFlow.signIn),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,28 +284,35 @@ final class EmailPasswordProvider implements EmailAuthProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<AuthOutcome> signInWithEmail(String email, String password) =>
|
||||
_run(() => fb.FirebaseAuth.instance.signInWithEmailAndPassword(
|
||||
email: email.trim(),
|
||||
password: password,
|
||||
));
|
||||
Future<AuthOutcome> signInWithEmail(String email, String password) => _run(
|
||||
() => fb.FirebaseAuth.instance.signInWithEmailAndPassword(
|
||||
email: email.trim(),
|
||||
password: password,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Future<AuthOutcome> signUpWithEmail(String email, String password) =>
|
||||
_run(() => fb.FirebaseAuth.instance.createUserWithEmailAndPassword(
|
||||
email: email.trim(),
|
||||
password: password,
|
||||
));
|
||||
Future<AuthOutcome> signUpWithEmail(String email, String password) => _run(
|
||||
() => fb.FirebaseAuth.instance.createUserWithEmailAndPassword(
|
||||
email: email.trim(),
|
||||
password: password,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Future<AuthOutcome> sendPasswordReset(String email) async {
|
||||
final missing = missingConfig;
|
||||
if (missing.isNotEmpty) return AuthNotConfigured(provider, missing);
|
||||
try {
|
||||
await fb.FirebaseAuth.instance.sendPasswordResetEmail(email: email.trim());
|
||||
await fb.FirebaseAuth.instance.sendPasswordResetEmail(
|
||||
email: email.trim(),
|
||||
);
|
||||
return const AuthCancelled();
|
||||
} on fb.FirebaseAuthException catch (error) {
|
||||
return AuthFailed(authCatalogCode(error), authMessage(error, flow: AuthFlow.signIn));
|
||||
return AuthFailed(
|
||||
authCatalogCode(error),
|
||||
authMessage(error, flow: AuthFlow.signIn),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +323,10 @@ final class EmailPasswordProvider implements EmailAuthProvider {
|
||||
final result = await action();
|
||||
return AuthSucceeded(_toAccount(result.user, provider));
|
||||
} on fb.FirebaseAuthException catch (error) {
|
||||
return AuthFailed(authCatalogCode(error), authMessage(error, flow: AuthFlow.signIn));
|
||||
return AuthFailed(
|
||||
authCatalogCode(error),
|
||||
authMessage(error, flow: AuthFlow.signIn),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +353,9 @@ String authCatalogCode(fb.FirebaseAuthException error) => switch (error.code) {
|
||||
'weak-password' => 'E-AUTH-05',
|
||||
'invalid-email' => 'E-AUTH-06',
|
||||
'too-many-requests' => 'E-AUTH-07',
|
||||
// 계정 연결(별첨 B v1.4) 경로에서만 나오는 코드들.
|
||||
// credential-already-in-use 는 계정 연결 경로에서만 나오지만,
|
||||
// account-exists-with-different-credential 은 로그인 경로에서도 난다.
|
||||
// 카탈로그 ID 는 같고 문구만 경로별로 갈린다(authMessage 참고).
|
||||
'credential-already-in-use' ||
|
||||
'account-exists-with-different-credential' => 'E-AUTH-08',
|
||||
'provider-already-linked' => 'E-AUTH-09',
|
||||
@@ -369,26 +387,24 @@ enum AuthFlow {
|
||||
/// 그 제공자로 들어가 달라고 안내해야 하고, **계정 연결** 경로에서는 「이 소셜
|
||||
/// 계정이 다른 FANUZU 계정에 이미 붙어 있다」다. 한 벌로 적으면 로그인에 실패한
|
||||
/// 사용자가 자기가 하지도 않은 계정 연결을 설명받고, 무엇을 해야 하는지 모른다.
|
||||
String authMessage(
|
||||
fb.FirebaseAuthException error, {
|
||||
required AuthFlow flow,
|
||||
}) => switch (error.code) {
|
||||
'email-already-in-use' => '이미 가입된 이메일입니다.',
|
||||
'weak-password' => '비밀번호가 너무 짧습니다. 8자 이상으로 정해 주세요.',
|
||||
'invalid-email' => '이메일 형식이 올바르지 않습니다.',
|
||||
'too-many-requests' => '잠시 후 다시 시도해 주세요.',
|
||||
'account-exists-with-different-credential' => switch (flow) {
|
||||
AuthFlow.signIn => _otherProviderSignInGuide(error.email),
|
||||
AuthFlow.link => '다른 FANUZU 계정에 이미 연결된 소셜 계정입니다.',
|
||||
},
|
||||
// 붙이려는 자격증명이 남의 UID 에 이미 달려 있다. 연결 경로에서만 난다.
|
||||
'credential-already-in-use' => '다른 FANUZU 계정에 이미 연결된 소셜 계정입니다.',
|
||||
'provider-already-linked' => '이미 연결된 계정입니다.',
|
||||
'no-such-provider' => '연결되어 있지 않은 계정입니다.',
|
||||
'operation-not-allowed' => '이 로그인 수단은 아직 사용할 수 없습니다.',
|
||||
'requires-recent-login' => '보안을 위해 다시 로그인한 뒤 시도해 주세요.',
|
||||
_ => '이메일 또는 비밀번호를 확인해 주세요.',
|
||||
};
|
||||
String authMessage(fb.FirebaseAuthException error, {required AuthFlow flow}) =>
|
||||
switch (error.code) {
|
||||
'email-already-in-use' => '이미 가입된 이메일입니다.',
|
||||
'weak-password' => '비밀번호가 너무 짧습니다. 8자 이상으로 정해 주세요.',
|
||||
'invalid-email' => '이메일 형식이 올바르지 않습니다.',
|
||||
'too-many-requests' => '잠시 후 다시 시도해 주세요.',
|
||||
'account-exists-with-different-credential' => switch (flow) {
|
||||
AuthFlow.signIn => _otherProviderSignInGuide(error.email),
|
||||
AuthFlow.link => '다른 FANUZU 계정에 이미 연결된 소셜 계정입니다.',
|
||||
},
|
||||
// 붙이려는 자격증명이 남의 UID 에 이미 달려 있다. 연결 경로에서만 난다.
|
||||
'credential-already-in-use' => '다른 FANUZU 계정에 이미 연결된 소셜 계정입니다.',
|
||||
'provider-already-linked' => '이미 연결된 계정입니다.',
|
||||
'no-such-provider' => '연결되어 있지 않은 계정입니다.',
|
||||
'operation-not-allowed' => '이 로그인 수단은 아직 사용할 수 없습니다.',
|
||||
'requires-recent-login' => '보안을 위해 다시 로그인한 뒤 시도해 주세요.',
|
||||
_ => '이메일 또는 비밀번호를 확인해 주세요.',
|
||||
};
|
||||
|
||||
/// 「먼저 쓰던 수단으로 로그인한 뒤 SNS 연동에서 붙이라」는 안내.
|
||||
///
|
||||
@@ -401,7 +417,11 @@ String authMessage(
|
||||
/// 시도한 자격증명이고, 기존 제공자를 알려면 `fetchSignInMethodsForEmail` 이
|
||||
/// 필요한데 이메일 열거 방지가 켜지면 빈 목록을 돌려준다. 이름까지 띄워야 하면
|
||||
/// 서버에서 Admin SDK 로 조회해 내려주는 쪽으로 올린다.
|
||||
///
|
||||
/// 이메일을 조사 앞에 바로 붙이지 않는다. 도메인 끝 글자가 모음인지 자음인지에
|
||||
/// 따라 「은/는」이 갈려 `example.co은` 같은 문구가 나간다. 「계정」을 사이에 두면
|
||||
/// 조사가 항상 맞는다.
|
||||
String _otherProviderSignInGuide(String? email) =>
|
||||
'${email == null ? '이 계정' : email}은 다른 로그인 수단으로 가입돼 있습니다. '
|
||||
'${email ?? '이'} 계정은 다른 로그인 수단으로 가입돼 있습니다. '
|
||||
'처음 가입에 쓰신 수단으로 로그인한 뒤 MY > 설정 > SNS 연동에서 '
|
||||
'이 수단을 연결해 주세요.';
|
||||
|
||||
Reference in New Issue
Block a user