mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: domain_del
This commit is contained in:
1 parent
60f8d4ce49
commit
06faa233f8
5 files changed
+33
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.2.39",
|
"version": "3.2.40",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export function registerResolver(
|
|||||||
const res = await func(arg, ctx, info);
|
const res = await func(arg, ctx, info);
|
||||||
if (typeof res !== 'object') return res;
|
if (typeof res !== 'object') return res;
|
||||||
if (handlers[value]) Object.assign(res, handlers[value]);
|
if (handlers[value]) Object.assign(res, handlers[value]);
|
||||||
|
ctx.parent = res;
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
if (handlers[typeName]) handlers[typeName][key.split('(')[0].trim()] = wrappedFunc;
|
if (handlers[typeName]) handlers[typeName][key.split('(')[0].trim()] = wrappedFunc;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { load } from 'js-yaml';
|
|||||||
import { Dictionary } from 'lodash';
|
import { Dictionary } from 'lodash';
|
||||||
import moment from 'moment-timezone';
|
import moment from 'moment-timezone';
|
||||||
import {
|
import {
|
||||||
DomainJoinAlreadyMemberError, DomainJoinForbiddenError, InvalidJoinInvitationCodeError,
|
DomainJoinAlreadyMemberError, DomainJoinForbiddenError, ForbiddenError,
|
||||||
RoleAlreadyExistError, ValidationError,
|
InvalidJoinInvitationCodeError, RoleAlreadyExistError, ValidationError,
|
||||||
} from '../error';
|
} from '../error';
|
||||||
import type { DomainDoc } from '../interface';
|
import type { DomainDoc } from '../interface';
|
||||||
import avatar from '../lib/avatar';
|
import avatar from '../lib/avatar';
|
||||||
@@ -56,6 +56,7 @@ class DomainEditHandler extends ManageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async post(args) {
|
async post(args) {
|
||||||
|
if (args.operation) return;
|
||||||
const $set = {};
|
const $set = {};
|
||||||
for (const key in args) {
|
for (const key in args) {
|
||||||
if (DOMAIN_SETTINGS_BY_KEY[key]) $set[key] = args[key];
|
if (DOMAIN_SETTINGS_BY_KEY[key]) $set[key] = args[key];
|
||||||
@@ -63,6 +64,13 @@ class DomainEditHandler extends ManageHandler {
|
|||||||
await domain.edit(args.domainId, $set);
|
await domain.edit(args.domainId, $set);
|
||||||
this.response.redirect = this.url('domain_dashboard');
|
this.response.redirect = this.url('domain_dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async postDelete({ password }) {
|
||||||
|
this.user.checkPassword(password);
|
||||||
|
if (this.domain.owner === this.user._id) throw new ForbiddenError('You are not the owner of this domain.');
|
||||||
|
await domain.del(this.domainId);
|
||||||
|
this.response.redirect = this.url('home_domain', { domainId: 'system' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DomainDashboardHandler extends ManageHandler {
|
class DomainDashboardHandler extends ManageHandler {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.27.16",
|
"version": "4.27.17",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -3,4 +3,24 @@
|
|||||||
<div class="section">
|
<div class="section">
|
||||||
{% include "partials/setting.html" %}
|
{% include "partials/setting.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<div class="section__header">
|
||||||
|
<h1 class="section__title" data-heading>{{ _('Delete Domain') }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="section__body">
|
||||||
|
<form method="POST">
|
||||||
|
{{ form.form_text({
|
||||||
|
type:'password',
|
||||||
|
label:'Password',
|
||||||
|
columns:10,
|
||||||
|
name:'password',
|
||||||
|
required:true
|
||||||
|
}) }}
|
||||||
|
<div>
|
||||||
|
<input type="hidden" name="operation" value="delete">
|
||||||
|
<input type="submit" value="{{ _('Delete Domain') }}" class="rounded primary button">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in new issue
Block a user