@@ -41,23 +41,23 @@ class AuthService {
4141
4242 /// Initiates the email sign-in process.
4343 ///
44- /// For standard sign-in (user-facing app), it generates a verification code,
45- /// stores it, and sends it via email without checking for user existence.
44+ /// This method is context-aware based on the [isDashboardLogin] flag.
4645 ///
47- /// For dashboard login (`isDashboardLogin: true` ), it first verifies that a
48- /// user with the given [email] exists and has either the 'admin' or
49- /// 'publisher' role before sending the code.
46+ /// - For the user-facing app (`isDashboardLogin: false` ), it generates and
47+ /// sends a verification code to the given [email] without pre-validation,
48+ /// supporting a unified sign-in/sign-up flow.
49+ /// - For the dashboard (`isDashboardLogin: true` ), it performs a strict
50+ /// login-only check. It verifies that a user with the given [email] exists
51+ /// and has either the 'admin' or 'publisher' role *before* sending a code.
5052 ///
5153 /// - [email] : The email address to send the code to.
5254 /// - [isDashboardLogin] : A flag to indicate if this is a login attempt from
5355 /// the dashboard, which enforces stricter checks.
5456 ///
55- /// Throws [InvalidInputException] for invalid email format (via email client).
5657 /// Throws [UnauthorizedException] if `isDashboardLogin` is true and the user
5758 /// does not exist.
5859 /// Throws [ForbiddenException] if `isDashboardLogin` is true and the user
5960 /// exists but lacks the required roles.
60- /// Throws [OperationFailedException] if code generation/storage/email fails.
6161 Future <void > initiateEmailSignIn (
6262 String email, {
6363 bool isDashboardLogin = false ,
@@ -123,19 +123,15 @@ class AuthService {
123123 ///
124124 /// This method is context-aware based on the [isDashboardLogin] flag.
125125 ///
126- /// - If `isDashboardLogin` is `true` , it validates the code and logs in the
127- /// existing user. It will not create a new user.
128- /// - If `isDashboardLogin` is `false` (default), it validates the code and
129- /// either logs in the existing user or creates a new one if they don't
130- /// exist.
131- /// New users are created with the 'standardUser' role.
126+ /// - For the dashboard (`isDashboardLogin: true` ), it validates the code and
127+ /// logs in the existing user. It will not create a new user in this flow.
128+ /// - For the user-facing app (`isDashboardLogin: false` ), it validates the
129+ /// code and either logs in the existing user or creates a new one with a
130+ /// 'standardUser' role if they don't exist.
132131 ///
133132 /// Returns the authenticated [User] and a new authentication token.
134133 ///
135134 /// Throws [InvalidInputException] if the code is invalid or expired.
136- /// Throws [UnauthorizedException] if `isDashboardLogin` is true and the user
137- /// is not found (as a safeguard).
138- /// Throws [OperationFailedException] for user lookup/creation or token errors.
139135 Future <({User user, String token})> completeEmailSignIn (
140136 String email,
141137 String code, {
@@ -187,7 +183,7 @@ class AuthService {
187183 print ('User not found for $email , creating new user.' );
188184
189185 // All new users created via the public API get the standard role.
190- // Admin users must be provisioned out-of-band (e.g., via databse seed ).
186+ // Admin users must be provisioned out-of-band (e.g., via fixtures ).
191187 final roles = [UserRoles .standardUser];
192188
193189 user = User (
0 commit comments