feat: setup app review accounts and automated E2E simulation
This commit is contained in:
@@ -83,8 +83,10 @@ export class AuthService {
|
||||
const ttl = this.config.get<number>('auth.otpTtl') ?? 300;
|
||||
await this.redis.set(this.otpKey(tenant.id, canonical), code, 'EX', ttl);
|
||||
|
||||
if (this.devMode) {
|
||||
this.logger.log(`OTP (dev) tenant=${tenant.slug} phone=${canonical} => ${code}`);
|
||||
// أرقام مخصصة لاختبارات E2E ومراجعي Apple/Google (لا تستهلك رصيد).
|
||||
const isAppReviewAccount = ['+962790000001', '+962790000002'].includes(canonical);
|
||||
if (this.devMode || isAppReviewAccount) {
|
||||
this.logger.log(`OTP (dev/review) tenant=${tenant.slug} phone=${canonical} => ${code}`);
|
||||
return { success: true, message: 'OTP sent (dev)', dev_code: code };
|
||||
}
|
||||
|
||||
@@ -105,8 +107,9 @@ export class AuthService {
|
||||
// بصيغة مختلفة قليلاً عن مرة الإرسال (مثال المالك: "01" مقابل "1").
|
||||
const canonical = this.phones.normalize(phone, tenant.countryPack);
|
||||
|
||||
// في وضع التطوير: الرمز الثابت 1234 يمرّ دائماً (تسهيل الاختبار).
|
||||
const devBypass = this.devMode && code === '1234';
|
||||
// في وضع التطوير أو حسابات مراجعة آبل/جوجل: الرمز الثابت 1234 يمرّ دائماً.
|
||||
const isAppReviewAccount = ['+962790000001', '+962790000002'].includes(canonical);
|
||||
const devBypass = (this.devMode || isAppReviewAccount) && code === '1234';
|
||||
if (!devBypass) {
|
||||
const attemptsKey = this.otpAttemptsKey(tenant.id, canonical);
|
||||
const attempts = await this.redis.incr(attemptsKey);
|
||||
|
||||
Reference in New Issue
Block a user