mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-20 03:21:25 +02:00
🔒 refactor(bots): remove !login command and enforce OIDC-only auth
- Remove !login and !logout commands from all 16+ Matrix bots - Remove login/logout references from all help/welcome messages - Disable password login in Synapse (password_config.enabled: false) - System is now OIDC-only via Mana Core authentication Users must authenticate via "Sign in with Mana Core" in Element. Existing bot access tokens remain valid. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c698318c91
commit
d81b8aebf2
30 changed files with 158 additions and 786 deletions
|
|
@ -9,7 +9,12 @@ import {
|
|||
COMMON_KEYWORDS,
|
||||
} from '@manacore/matrix-bot-common';
|
||||
import { SkilltreeService, Skill, SkillBranch } from '../skilltree/skilltree.service';
|
||||
import { SessionService, TranscriptionService, CreditService } from '@manacore/bot-services';
|
||||
import {
|
||||
SessionService,
|
||||
TranscriptionService,
|
||||
CreditService,
|
||||
LOGIN_MESSAGES,
|
||||
} from '@manacore/bot-services';
|
||||
import { HELP_MESSAGE } from '../config/configuration';
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -98,15 +103,6 @@ export class MatrixService extends BaseMatrixService {
|
|||
await this.sendMessage(roomId, HELP_MESSAGE);
|
||||
break;
|
||||
|
||||
case 'login':
|
||||
await this.handleLogin(roomId, sender, args);
|
||||
break;
|
||||
|
||||
case 'logout':
|
||||
await this.sessionService.logout(sender);
|
||||
await this.sendMessage(roomId, '<p>Erfolgreich abgemeldet.</p>');
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
await this.handleStatus(roomId, sender);
|
||||
break;
|
||||
|
|
@ -192,40 +188,11 @@ export class MatrixService extends BaseMatrixService {
|
|||
private async requireAuth(sender: string): Promise<string> {
|
||||
const token = await this.sessionService.getToken(sender);
|
||||
if (!token) {
|
||||
throw new Error('Nicht angemeldet. Nutze <code>!login email passwort</code>');
|
||||
throw new Error(LOGIN_MESSAGES.skilltree);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
// Auth handlers
|
||||
private async handleLogin(roomId: string, sender: string, args: string[]) {
|
||||
if (args.length < 2) {
|
||||
await this.sendMessage(roomId, '<p>Verwendung: <code>!login email passwort</code></p>');
|
||||
return;
|
||||
}
|
||||
|
||||
const [email, password] = args;
|
||||
const result = await this.sessionService.login(sender, email, password);
|
||||
|
||||
if (result.success) {
|
||||
const token = await this.sessionService.getToken(sender);
|
||||
if (token) {
|
||||
const balance = await this.creditService.getBalance(token);
|
||||
await this.sendMessage(
|
||||
roomId,
|
||||
`<p>✅ Erfolgreich angemeldet als <strong>${email}</strong><br/>⚡ Credits: ${balance.balance.toFixed(2)}</p>`
|
||||
);
|
||||
} else {
|
||||
await this.sendMessage(
|
||||
roomId,
|
||||
`<p>✅ Erfolgreich angemeldet als <strong>${email}</strong></p>`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await this.sendMessage(roomId, `<p>Login fehlgeschlagen: ${result.error}</p>`);
|
||||
}
|
||||
}
|
||||
|
||||
private async handleStatus(roomId: string, sender: string) {
|
||||
const backendOk = await this.skilltreeService.checkHealth();
|
||||
const loggedIn = await this.sessionService.isLoggedIn(sender);
|
||||
|
|
|
|||
|
|
@ -17,13 +17,6 @@ export default () => ({
|
|||
|
||||
export const HELP_MESSAGE = `<h2>Skilltree Bot - Befehle</h2>
|
||||
|
||||
<h3>Authentifizierung</h3>
|
||||
<ul>
|
||||
<li><code>!login email passwort</code> - Anmelden</li>
|
||||
<li><code>!logout</code> - Abmelden</li>
|
||||
<li><code>!status</code> - Bot-Status anzeigen</li>
|
||||
</ul>
|
||||
|
||||
<h3>Skills</h3>
|
||||
<ul>
|
||||
<li><code>!skills</code> - Alle Skills auflisten</li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue