Add SEO sitemap/robots + real SMS OTP (Kavenegar, admin-configured)
- /sitemap.xml (static pages + open shifts + fresh jobs, respecting expiry) + /robots.txt (blocks /Admin,/Employer); base URL from forwarded request → https://hamkadr.ir in prod - ISmsSender + KavenegarSmsSender (verify/lookup template, sms/send fallback); SMS settings (enabled/apikey/template/sender) in /Admin/Settings; OtpService.IssueAsync sends SMS and stops revealing the code when enabled (dev still shows it); migration Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -44,9 +44,13 @@
|
||||
{
|
||||
<div class="alert alert-success">
|
||||
کد تأیید (حالت توسعه): <strong dir="ltr">@Model.DevCode</strong><br />
|
||||
<span style="font-size:12px;">در نسخهی نهایی این کد از طریق پیامک (کاوهنگار/SMS.ir) ارسال میشود.</span>
|
||||
<span style="font-size:12px;">در حالت عادی این کد با پیامک ارسال میشود.</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-success">کد تأیید با پیامک به شماره شما ارسال شد.</div>
|
||||
}
|
||||
<form method="post">
|
||||
<input type="hidden" name="Phone" value="@Model.Phone" />
|
||||
<input type="hidden" name="AccountType" value="@Model.AccountType" />
|
||||
|
||||
@@ -36,7 +36,7 @@ public class LoginModel : PageModel
|
||||
|
||||
public void OnGet() { }
|
||||
|
||||
public IActionResult OnPostRequestCode()
|
||||
public async Task<IActionResult> OnPostRequestCodeAsync()
|
||||
{
|
||||
var phone = OtpService.Normalize(Phone);
|
||||
if (phone.Length < 10)
|
||||
@@ -45,7 +45,7 @@ public class LoginModel : PageModel
|
||||
return Page();
|
||||
}
|
||||
Phone = phone;
|
||||
DevCode = _otp.Issue(phone); // dev: surface the code; prod: SMS gateway sends it
|
||||
DevCode = await _otp.IssueAsync(phone); // null when SMS is enabled (sent via gateway)
|
||||
CodeSent = true;
|
||||
return Page();
|
||||
}
|
||||
|
||||
@@ -115,6 +115,25 @@
|
||||
<p class="muted" style="font-size:12px; margin:4px 0 0;">آگهیهای تکراری بهصورت خودکار رد میشوند؛ هر اجرا فقط آگهیهای جدید را میآورد.</p>
|
||||
</div>
|
||||
|
||||
<hr style="border:none; border-top:1px solid var(--line); margin:18px 0;" />
|
||||
|
||||
<h3 style="margin-top:0;">پیامک ورود (OTP) — کاوهنگار</h3>
|
||||
<div class="filter-group">
|
||||
<label style="display:flex; align-items:center; gap:8px; font-weight:700;">
|
||||
<input type="checkbox" name="SmsEnabled" value="true" style="width:auto;" checked="@Model.SmsEnabled" />
|
||||
ارسال کد ورود با پیامک (در صورت خاموش بودن، کد روی صفحه نمایش داده میشود)
|
||||
</label>
|
||||
</div>
|
||||
<div class="filter-group">
|
||||
<label>کلید API کاوهنگار</label>
|
||||
<input type="password" name="SmsApiKey" value="@Model.SmsApiKey" dir="ltr" />
|
||||
</div>
|
||||
<div class="filter-group" style="display:flex; gap:8px;">
|
||||
<div style="flex:1;"><label>نام تمپلیت verify (ترجیحی)</label><input type="text" name="SmsTemplate" value="@Model.SmsTemplate" dir="ltr" placeholder="otp" /></div>
|
||||
<div style="flex:1;"><label>خط ارسال (در نبود تمپلیت)</label><input type="text" name="SmsSender" value="@Model.SmsSender" dir="ltr" placeholder="10008..." /></div>
|
||||
</div>
|
||||
<p class="muted" style="font-size:12px;">روش پیشنهادی: تمپلیت verify/lookup با متغیر %token. اگر تمپلیت خالی باشد، پیامک ساده با خط ارسال فرستاده میشود.</p>
|
||||
|
||||
<button type="submit" class="btn btn-accent btn-block btn-lg">ذخیره تنظیمات</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -32,6 +32,10 @@ public class SettingsModel : PageModel
|
||||
[BindProperty] public string? DivarQueries { get; set; }
|
||||
[BindProperty] public bool MedjobsEnabled { get; set; }
|
||||
[BindProperty] public int MedjobsMaxAds { get; set; } = 40;
|
||||
[BindProperty] public bool SmsEnabled { get; set; }
|
||||
[BindProperty] public string? SmsApiKey { get; set; }
|
||||
[BindProperty] public string? SmsTemplate { get; set; }
|
||||
[BindProperty] public string? SmsSender { get; set; }
|
||||
[TempData] public string? Saved { get; set; }
|
||||
|
||||
public async Task OnGetAsync()
|
||||
@@ -56,6 +60,10 @@ public class SettingsModel : PageModel
|
||||
DivarQueries = s.DivarQueries;
|
||||
MedjobsEnabled = s.MedjobsEnabled;
|
||||
MedjobsMaxAds = s.MedjobsMaxAds;
|
||||
SmsEnabled = s.SmsEnabled;
|
||||
SmsApiKey = s.SmsApiKey;
|
||||
SmsTemplate = s.SmsTemplate;
|
||||
SmsSender = s.SmsSender;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostAsync()
|
||||
@@ -81,6 +89,10 @@ public class SettingsModel : PageModel
|
||||
DivarQueries = DivarQueries,
|
||||
MedjobsEnabled = MedjobsEnabled,
|
||||
MedjobsMaxAds = MedjobsMaxAds,
|
||||
SmsEnabled = SmsEnabled,
|
||||
SmsApiKey = SmsApiKey,
|
||||
SmsTemplate = SmsTemplate,
|
||||
SmsSender = SmsSender,
|
||||
});
|
||||
Saved = "تنظیمات ذخیره شد.";
|
||||
return RedirectToPage();
|
||||
|
||||
Reference in New Issue
Block a user