Commit 5e1207c9 authored by Vytor Calixto's avatar Vytor Calixto 👾

Página dos usuários (quase) feita

Falta opção para tornar usuário adm ou moderador e retirar os privilégios
parent 5fc126ed
<!DOCTYPE html>
<html>
<% include ../partials/head %>
<body>
<% include ../partials/admin-header %>
<% if (message.length > 0) { %>
<div class="card margin"><%= message %></div>
<% } %>
<section class="page-wrap margin card">
<h1><%= usuario.nome %></h1>
<form method="post">
<label for="nome">Nome: </label>
<input type="text" name="nome" value="<%= usuario.nome %>">
<br>
<label for="nome">Username: </label>
<input type="text" name="username" value="<%= usuario.username %>">
<br>
<label for="nome">E-mail: </label>
<input type="text" name="email" value="<%= usuario.email %>">
<br>
<input type="submit" name="submit" value="Enviar" class="button normal">
<a href="/admin/professores" class="button red">Cancelar</a>
</form>
</section>
<% include ../partials/footer %>
</body>
</html>
......@@ -5,9 +5,6 @@
<% include ../partials/admin-header %>
<section class="page-wrap">
<% if (message.length > 0) { %>
<% if (message.length > 0) { %>
<div class="card margin"><%= message %></div>
<% } %>
<% if (message == "successDelete") { %>
<script>
swal("Deletado!", "O usuário foi deletado com sucesso.", "success");
......
......@@ -45,8 +45,8 @@ router.post('/:id', function(req, res) {
usuario.nome = req.body.nome
usuario.username = req.body.username
usuario.email = req.body.email
usuario.admin = req.body.admin
usuario.moderador = req.body.moderador
usuario.admin = req.body.admin || usuario.admin
usuario.moderador = req.body.moderador || usuario.moderador
usuario.save(function(err) {
if(!err) {
......@@ -54,6 +54,7 @@ router.post('/:id', function(req, res) {
res.redirect('/admin/usuarios')
} else {
// TODO: redirecionar para 500
console.log(err);
res.redirect('/')
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment