名称Branding变更

This commit is contained in:
biss committed 2026-09-29 10:42:28 +08:00
1 parent c74c1e3914
commit 8b5103d542
41 files changed
+282 -93

No files matched your search

@@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
using Jiaowu.Api.Domain.Identity;
using Jiaowu.Api.Infrastructure.Branding;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
@@ -10,7 +11,9 @@ namespace Jiaowu.Api.Controllers;
[ApiController]
[Authorize]
[Route("api/auth/security")]
public sealed class AccountSecurityController(UserManager<ApplicationUser> userManager) : ControllerBase
public sealed class AccountSecurityController(
UserManager<ApplicationUser> userManager,
BrandingOptions brandingOptions) : ControllerBase
{
[HttpGet("totp")]
public async Task<ActionResult> GetTotpStatus()
@@ -30,7 +33,7 @@ public sealed class AccountSecurityController(UserManager<ApplicationUser> userM
await userManager.ResetAuthenticatorKeyAsync(user);
var key = await userManager.GetAuthenticatorKeyAsync(user);
if (string.IsNullOrWhiteSpace(key)) return Problem("无法创建验证器密钥。");
var issuer = "明序教务";
var issuer = brandingOptions.ShortName;
var account = Uri.EscapeDataString(user.UserName ?? user.Id.ToString("D"));
var label = Uri.EscapeDataString($"{issuer}:{user.UserName}");
var uri = $"otpauth://totp/{label}?secret={key}&issuer={Uri.EscapeDataString(issuer)}&digits=6";
@@ -3,6 +3,7 @@ using Jiaowu.Api.Domain.Identity;
using Jiaowu.Api.Domain.System;
using Jiaowu.Api.Infrastructure.Auth;
using Jiaowu.Api.Infrastructure.Caching;
using Jiaowu.Api.Infrastructure.Branding;
using Jiaowu.Api.Infrastructure.Grades;
using Jiaowu.Api.Infrastructure.Files;
using Jiaowu.Api.Infrastructure.OfficialDocuments;
@@ -20,6 +21,7 @@ public sealed class GradeAnalyticsController(
AppDbContext db,
ICurrentUserDataScope currentUserDataScope,
OfficialDocumentOptions officialDocumentOptions,
BrandingOptions brandingOptions,
IAppCache? cache = null) : ControllerBase
{
private const string AnalyticsUsers =
@@ -345,7 +347,7 @@ public sealed class GradeAnalyticsController(
if (report is null) return NotFound();
var content = GradeAnalysisWordReportGenerator.Generate(
report, DateTime.Now, officialDocumentOptions.FontPath);
report, DateTime.Now, brandingOptions.ProductName, officialDocumentOptions.FontPath);
var fileName = DownloadFileName.Export("科目总体成绩分析报告", ".docx",
report.Summary.CourseCode, academicTermId.HasValue ? "指定学期" : "全部学期");
return File(content,
@@ -622,7 +624,7 @@ public sealed class GradeAnalyticsController(
});
var content = GradeAnalysisWordReportGenerator.Generate(
report, DateTime.Now, officialDocumentOptions.FontPath);
report, DateTime.Now, brandingOptions.ProductName, officialDocumentOptions.FontPath);
var fileName = DownloadFileName.Export("成绩分析报告", ".docx", report.CourseCode, report.TaskNumber);
return File(
content,
+3 -3
View File
@@ -321,13 +321,13 @@ public sealed class SsoController(
SsoAuthSchemes.LoginProvider,
ticket.Subject);
if (subjectOwner is not null && subjectOwner.Id != user.Id)
return BindingConflict("该统一身份账号已绑定其他教务系统账号。");
return BindingConflict("该统一身份账号已绑定其他平台账号。");
var keycloakLogins = (await userManager.GetLoginsAsync(user))
.Where(x => x.LoginProvider == SsoAuthSchemes.LoginProvider)
.ToList();
if (keycloakLogins.Any(x => x.ProviderKey != ticket.Subject))
return BindingConflict("该教务系统账号已绑定其他统一身份账号。");
return BindingConflict("该平台账号已绑定其他统一身份账号。");
if (subjectOwner is null)
{
@@ -563,7 +563,7 @@ public sealed class SsoController(
Unauthorized(new ProblemDetails
{
Title = "账户绑定失败",
Detail = "教务系统账号或密码不正确,或账号已停用。",
Detail = "平台账号或密码不正确,或账号已停用。",
Status = StatusCodes.Status401Unauthorized
});
Loaded 3 of 41 files, more files were not shown because too many files have changed in this diff. Show more