Browse Source

Disable problem creation when not logged in

pull/6/head
Pisces000221 8 years ago
parent
commit
a0ade9138a
  1. 1
      modules/problem.js
  2. 2
      views/problems.ejs

1
modules/problem.js

@ -84,6 +84,7 @@ app.get('/problem/:id/edit', async (req, res) => {
let problem = await Problem.fromID(id);
if (!problem) {
if (!res.locals.user) throw 'Permission denied.';
problem = await Problem.create();
problem.id = id;
problem.allowedEdit = true;

2
views/problems.ejs

@ -1,6 +1,7 @@
<% this.title = '题库' %>
<% include header %>
<div class="padding">
<% if (user) { %>
<div class="ui grid">
<div class="row">
<div class="column">
@ -8,6 +9,7 @@
</div>
</div>
</div>
<% } %>
<table class="ui very basic center aligned table">
<thead>
<tr>

Loading…
Cancel
Save