Commit 3f704a60 authored by Vytor Calixto's avatar Vytor Calixto 👾
Browse files

Login e signup locais

parent d138eb21
......@@ -15,4 +15,6 @@ results
npm-debug.log
node_modules
bower_components
bower_components/
uploads/*
{
"name": "Farol",
"version": "0.0.0",
"homepage": "https://github.com/PETComputacaoUFPR",
"authors": [
"PET Computação UFPR <pet@inf.ufpr.br>"
],
"description": "Farol - Respositório de provas e trabalhos",
"main": "index.html",
"keywords": [
"ufpr",
"farol",
"pet"
],
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.3.15",
"components-font-awesome": "~4.3.0",
"angular-ui-router": "~0.2.14",
"angular-ui-utils": "bower-keypress",
"sweetalert": "~0.5.0",
"angular-file-upload": "~2.1.1",
"angular-resource": "~1.4.4"
}
}
......@@ -242,8 +242,7 @@ footer {
background-size: contain;
background-repeat: no-repeat;
margin-top: 20px;
padding-top: 20%;
height: 100%; }
padding-top: 20%; }
.index h1 {
margin: 0;
font-family: 'Montserrat', sans-serif;
......@@ -286,8 +285,7 @@ footer {
.header {
text-align: left;
padding: 0;
height: 100%; }
padding: 0; }
.header nav {
display: inline-block;
height: 100%;
......
.card,.search-bar{box-sizing:border-box}.clickable,a:hover{cursor:pointer}@font-face{font-family:Montserrat;font-style:normal;font-weight:400;src:local('Montserrat-Regular'),url(https://fonts.gstatic.com/s/montserrat/v6/zhcz-_WihjSQC0oHJ9TCYC3USBnSvpkopQaUR-2r7iU.ttf) format('truetype')}@font-face{font-family:Merriweather;font-style:normal;font-weight:400;src:local('Merriweather'),url(https://fonts.gstatic.com/s/merriweather/v8/RFda8w1V0eDZheqfcyQ4EInF5uFdDttMLvmWuJdhhgs.ttf) format('truetype')}.clearfix:after,.clearfix:before,.header:after,.header:before,.list .list-item:after,.list .list-item:before{display:block;clear:both;content:''}.normal{background-color:#39628d}.dark,header{background-color:#1E2251}.darker{background-color:#1a1a1a}.button:active,.icon-button:active,.light{background-color:#bfdede}.lighter,body{background-color:#F5F5F5}.red,footer{background-color:#EE3437}.error{background-color:#EE3437!important}.inactive{background-color:grey}.float-right{float:right}.float-left{float:left}.margin{margin:20px}.no-margin{margin:0}.margin-vertical{margin-top:20px;margin-bottom:20px}.margin-horizontal{margin-left:20px;margin-right:20px}.padding{padding:20px}.no-padding{padding:0}.padding-vertical{padding-top:20px;padding-bottom:20px}.padding-horizontal{padding-left:20px;padding-right:20px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.center-vertical{margin:auto 0}.center-block{display:table;margin:auto}.full{width:100%}.half{width:50%}.one-third{width:33%}.two-thirds{width:66%}.one-quarter{width:25%}.three-quarters{width:75%}.inline-block{display:inline-block}.button,.icon-button{color:#fff!important;border:none;border-radius:2px;font-size:110%;padding:5px;margin-top:10px;margin-bottom:10px;-webkit-transition:background-color .2s ease;-moz-transition:background-color .2s ease;-ms-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}footer,header,header a,header a:hover{color:#fff}.button:hover,.icon-button:hover{cursor:pointer;text-decoration:none}.button:active,.icon-button:active{-webkit-transition:background-color .2s ease-out;-moz-transition:background-color .2s ease-out;-ms-transition:background-color .2s ease-out;-o-transition:background-color .2s ease-out;transition:background-color .2s ease-out}.button:focus,.icon-button:focus{outline:0}.float-button{position:relative;top:-1.3em}.icon-button{border-radius:0;font-family:FontAwesome;font-size:1.5em;position:relative;top:1.5px;left:-6px;color:#fff;padding:6px;-webkit-transition:background-color .2s ease-in-out;-moz-transition:background-color .2s ease-in-out;-ms-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}body,footer a:hover{color:#1a1a1a}.button-circle{border-radius:50%}.list .list-title{padding:20px;text-align:center}.list .list-item{margin:0;padding:20px;border-top:1px solid #ccc}ul.list{list-style-type:none;padding:0;margin:0}.card{padding:20px;box-shadow:0 1px 2px #aaa;background:#fff;margin-bottom:20px}.card>.card{box-shadow:0 2px 5px #aaa}.card-list{padding:0}.page-wrap{margin-bottom:4em}.page-wrap:after{content:"";display:block}.header form,.header h2,.header nav,.uploadInfo{display:inline-block}.sticky{position:absolute;bottom:0;width:100%;height:4em}.header nav,html{position:relative}html{min-height:100%}body{font-family:Merriweather,serif;padding-bottom:4em;text-align:center;margin:0}a{color:#39628d;text-decoration:none}a:hover{text-decoration:underline;color:#1E2251}form{margin:0 auto}header,nav{font-family:Montserrat,sans-serif}header{box-shadow:1px 1px 3px rgba(0,0,0,.6);padding:5px 0}header h3{font-weight:100}footer{padding:20px 0}footer a{color:inherit}.index{background-image:url(../imgs/Farol.png);background-position:center center;background-size:contain;background-repeat:no-repeat;margin-top:20px;padding-top:20%;height:100%}.index h1{margin:0;font-family:Montserrat,sans-serif;font-size:5em;text-transform:uppercase;color:#1E2251;text-shadow:-1px -1px 0 #F5F5F5,1px -1px 0 #F5F5F5,-1px 1px 0 #F5F5F5,1px 1px 0 #F5F5F5}.search-bar{background-color:rgba(255,255,255,.9);box-shadow:inset 0 1px 3px #ddd;font-size:1.3em;padding:5px;border:1px solid #bfdede}.search-bar:focus{border:1px solid #39628d;outline:0}.search-bar::-webkit-search-cancel-button{-webkit-appearance:none}.search-bar::-webkit-search-cancel-button:after{font-family:FontAwesome;content:'\f00d';color:#EE3437}.uploadInfo{box-shadow:2px 2px 15px rgba(0,0,0,.4);background-color:#fff;width:200px;margin:5px 15px}.uploadThumb{max-width:100%}.thumb{height:75px;border:1px solid #bfdede;margin:10px 5px 0 0}.header{text-align:left;padding:0;height:100%}.header nav{height:100%;bottom:0}.header form .search-bar{width:25pc}.header h2{padding:20px 20px 0}.header h2 a{color:#fff;text-decoration:none}.header h2 a:hover{text-decoration:underline}.warning{border:1px solid #EE3437}.hover-shadow{box-shadow:0 0 0 rgba(0,0,0,.6);-webkit-transition:box-shadow .2s ease-in-out;-moz-transition:box-shadow .2s ease-in-out;-ms-transition:box-shadow .2s ease-in-out;-o-transition:box-shadow .2s ease-in-out;transition:box-shadow .2s ease-in-out}.hover-shadow:hover{box-shadow:2px 2px 5px rgba(0,0,0,.6);-webkit-transition:box-shadow .2s ease-in-out;-moz-transition:box-shadow .2s ease-in-out;-ms-transition:box-shadow .2s ease-in-out;-o-transition:box-shadow .2s ease-in-out;transition:box-shadow .2s ease-in-out}
\ No newline at end of file
.card,.search-bar{box-sizing:border-box}.clickable,a:hover{cursor:pointer}@font-face{font-family:Montserrat;font-style:normal;font-weight:400;src:local('Montserrat-Regular'),url(https://fonts.gstatic.com/s/montserrat/v6/zhcz-_WihjSQC0oHJ9TCYC3USBnSvpkopQaUR-2r7iU.ttf) format('truetype')}@font-face{font-family:Merriweather;font-style:normal;font-weight:400;src:local('Merriweather'),url(https://fonts.gstatic.com/s/merriweather/v8/RFda8w1V0eDZheqfcyQ4EInF5uFdDttMLvmWuJdhhgs.ttf) format('truetype')}.clearfix:after,.clearfix:before,.header:after,.header:before,.list .list-item:after,.list .list-item:before{display:block;clear:both;content:''}.normal{background-color:#39628d}.dark,header{background-color:#1E2251}.darker{background-color:#1a1a1a}.button:active,.icon-button:active,.light{background-color:#bfdede}.lighter,body{background-color:#F5F5F5}.red,footer{background-color:#EE3437}.error{background-color:#EE3437!important}.inactive{background-color:grey}.float-right{float:right}.float-left{float:left}.margin{margin:20px}.no-margin{margin:0}.margin-vertical{margin-top:20px;margin-bottom:20px}.margin-horizontal{margin-left:20px;margin-right:20px}.padding{padding:20px}.no-padding{padding:0}.padding-vertical{padding-top:20px;padding-bottom:20px}.padding-horizontal{padding-left:20px;padding-right:20px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.center-vertical{margin:auto 0}.center-block{display:table;margin:auto}.full{width:100%}.half{width:50%}.one-third{width:33%}.two-thirds{width:66%}.one-quarter{width:25%}.three-quarters{width:75%}.inline-block{display:inline-block}.button,.icon-button{color:#fff!important;border:none;border-radius:2px;font-size:110%;padding:5px;margin-top:10px;margin-bottom:10px;-webkit-transition:background-color .2s ease;-moz-transition:background-color .2s ease;-ms-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}footer,header,header a,header a:hover{color:#fff}.button:hover,.icon-button:hover{cursor:pointer;text-decoration:none}.button:active,.icon-button:active{-webkit-transition:background-color .2s ease-out;-moz-transition:background-color .2s ease-out;-ms-transition:background-color .2s ease-out;-o-transition:background-color .2s ease-out;transition:background-color .2s ease-out}.button:focus,.icon-button:focus{outline:0}.float-button{position:relative;top:-1.3em}.icon-button{border-radius:0;font-family:FontAwesome;font-size:1.5em;position:relative;top:1.5px;left:-6px;color:#fff;padding:6px;-webkit-transition:background-color .2s ease-in-out;-moz-transition:background-color .2s ease-in-out;-ms-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}body,footer a:hover{color:#1a1a1a}.button-circle{border-radius:50%}.list .list-title{padding:20px;text-align:center}.list .list-item{margin:0;padding:20px;border-top:1px solid #ccc}ul.list{list-style-type:none;padding:0;margin:0}.card{padding:20px;box-shadow:0 1px 2px #aaa;background:#fff;margin-bottom:20px}.card>.card{box-shadow:0 2px 5px #aaa}.card-list{padding:0}.page-wrap{margin-bottom:4em}.page-wrap:after{content:"";display:block}.header form,.header h2,.header nav,.uploadInfo{display:inline-block}.sticky{position:absolute;bottom:0;width:100%;height:4em}.header nav,html{position:relative}html{min-height:100%}body{font-family:Merriweather,serif;padding-bottom:4em;text-align:center;margin:0}a{color:#39628d;text-decoration:none}a:hover{text-decoration:underline;color:#1E2251}form{margin:0 auto}header,nav{font-family:Montserrat,sans-serif}header{box-shadow:1px 1px 3px rgba(0,0,0,.6);padding:5px 0}header h3{font-weight:100}footer{padding:20px 0}footer a{color:inherit}.index{background-image:url(../imgs/Farol.png);background-position:center center;background-size:contain;background-repeat:no-repeat;margin-top:20px;padding-top:20%}.index h1{margin:0;font-family:Montserrat,sans-serif;font-size:5em;text-transform:uppercase;color:#1E2251;text-shadow:-1px -1px 0 #F5F5F5,1px -1px 0 #F5F5F5,-1px 1px 0 #F5F5F5,1px 1px 0 #F5F5F5}.search-bar{background-color:rgba(255,255,255,.9);box-shadow:inset 0 1px 3px #ddd;font-size:1.3em;padding:5px;border:1px solid #bfdede}.search-bar:focus{border:1px solid #39628d;outline:0}.search-bar::-webkit-search-cancel-button{-webkit-appearance:none}.search-bar::-webkit-search-cancel-button:after{font-family:FontAwesome;content:'\f00d';color:#EE3437}.uploadInfo{box-shadow:2px 2px 15px rgba(0,0,0,.4);background-color:#fff;width:200px;margin:5px 15px}.uploadThumb{max-width:100%}.thumb{height:75px;border:1px solid #bfdede;margin:10px 5px 0 0}.header{text-align:left;padding:0}.header nav{height:100%;bottom:0}.header form .search-bar{width:25pc}.header h2{padding:20px 20px 0}.header h2 a{color:#fff;text-decoration:none}.header h2 a:hover{text-decoration:underline}.warning{border:1px solid #EE3437}.hover-shadow{box-shadow:0 0 0 rgba(0,0,0,.6);-webkit-transition:box-shadow .2s ease-in-out;-moz-transition:box-shadow .2s ease-in-out;-ms-transition:box-shadow .2s ease-in-out;-o-transition:box-shadow .2s ease-in-out;transition:box-shadow .2s ease-in-out}.hover-shadow:hover{box-shadow:2px 2px 5px rgba(0,0,0,.6);-webkit-transition:box-shadow .2s ease-in-out;-moz-transition:box-shadow .2s ease-in-out;-ms-transition:box-shadow .2s ease-in-out;-o-transition:box-shadow .2s ease-in-out;transition:box-shadow .2s ease-in-out}
\ No newline at end of file
......@@ -13,119 +13,119 @@ $font-size: 1.3em;
@import "footer";
html{
min-height: 100%;
position: relative;
min-height: 100%;
position: relative;
}
body{
font-family: Merriweather, serif;
color: $squid-ink;
padding-bottom: $sticky-footer-height;
text-align: center;
margin: 0;
@extend .lighter;
font-family: Merriweather, serif;
color: $squid-ink;
padding-bottom: $sticky-footer-height;
text-align: center;
margin: 0;
@extend .lighter;
}
a{
color: $deep-sea;
text-decoration: none;
&:hover{
text-decoration: underline;
cursor: pointer;
color: $nautical;
}
color: $deep-sea;
text-decoration: none;
&:hover{
text-decoration: underline;
cursor: pointer;
color: $nautical;
}
}
form{
margin: 0 auto;
margin: 0 auto;
}
header, nav{
font-family: Montserrat, sans-serif;
font-family: Montserrat, sans-serif;
}
header{
@extend .dark;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
padding: 5px 0 5px 0;
color: white;
a{
color: white;
&:hover{
color: white;
}
}
h3{
font-weight: 100;
}
@extend .dark;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
padding: 5px 0 5px 0;
color: white;
a{
color: white;
&:hover{
color: white;
}
}
h3{
font-weight: 100;
}
}
footer{
@extend .red;
color: white;
padding: $padding 0 $padding 0;
a{
color: inherit;
&:hover{
color: $squid-ink;
}
}
@extend .red;
color: white;
padding: $padding 0 $padding 0;
a{
color: inherit;
&:hover{
color: $squid-ink;
}
}
}
.index{
background-image: url(../imgs/Farol.png);
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
margin-top: 20px;
padding-top: 20%;
height: 100%;
h1{
margin: 0;
font-family: 'Montserrat', sans-serif;
font-size: 5em;
text-transform: uppercase;
color: $nautical;
//text-shadow: 0px 0px 5px $light-gray;
text-shadow:
-1px -1px 0 $light-gray,
1px -1px 0 $light-gray,
-1px 1px 0 $light-gray,
1px 1px 0 $light-gray;
}
background-image: url(../imgs/Farol.png);
background-position: center center;
background-size: contain;
background-repeat: no-repeat;
margin-top: 20px;
padding-top: 20%;
// height: 100%;
h1{
margin: 0;
font-family: 'Montserrat', sans-serif;
font-size: 5em;
text-transform: uppercase;
color: $nautical;
//text-shadow: 0px 0px 5px $light-gray;
text-shadow:
-1px -1px 0 $light-gray,
1px -1px 0 $light-gray,
-1px 1px 0 $light-gray,
1px 1px 0 $light-gray;
}
}
.search-bar{
background-color: rgba(255,255,255,0.9);
box-shadow: inset 0px 1px 3px #ddd;
font-size: $font-size;
padding: 5px;
border: 1px solid $aqua;
box-sizing: border-box;
&:focus{
border: 1px solid $deep-sea;
outline: 0;
}
&::-webkit-search-cancel-button{
-webkit-appearance: none;
&:after{
font-family: FontAwesome;
content:'\f00d';
color: $crimson;
}
}
background-color: rgba(255,255,255,0.9);
box-shadow: inset 0px 1px 3px #ddd;
font-size: $font-size;
padding: 5px;
border: 1px solid $aqua;
box-sizing: border-box;
&:focus{
border: 1px solid $deep-sea;
outline: 0;
}
&::-webkit-search-cancel-button{
-webkit-appearance: none;
&:after{
font-family: FontAwesome;
content:'\f00d';
color: $crimson;
}
}
}
.uploadInfo{
box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.4);
background-color: white;
width: 200px;
margin: 5px 15px 5px 15px;
display: inline-block;
box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.4);
background-color: white;
width: 200px;
margin: 5px 15px 5px 15px;
display: inline-block;
}
.uploadThumb{
max-width: 100%;
max-width: 100%;
}
.thumb{
......@@ -135,50 +135,50 @@ footer{
}
.header{
text-align: left;
padding: 0;//0px 10px 0px 10px;
@extend %clearfix;
height: 100%;
nav{
//min-height: 29px;
display: inline-block;
height: 100%;
position: relative;
bottom:0;
}
h2, form{
display: inline-block;
}
form{
.search-bar{
width: 400px;
}
}
h2{
padding: $padding $padding 0 $padding;
a{
color: white;
text-decoration: none;
&:hover{
text-decoration: underline;
}
}
}
text-align: left;
padding: 0;//0px 10px 0px 10px;
@extend %clearfix;
// height: 100%;
nav{
//min-height: 29px;
display: inline-block;
height: 100%;
position: relative;
bottom:0;
}
h2, form{
display: inline-block;
}
form{
.search-bar{
width: 400px;
}
}
h2{
padding: $padding $padding 0 $padding;
a{
color: white;
text-decoration: none;
&:hover{
text-decoration: underline;
}
}
}
}
.warning{
border: 1px solid $crimson;
border: 1px solid $crimson;
}
.hover-shadow{
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.6);
@include transition(box-shadow, 0.2s, ease-in-out);
&:hover{
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
@include transition(box-shadow, 0.2s, ease-in-out);
}
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.6);
@include transition(box-shadow, 0.2s, ease-in-out);
&:hover{
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
@include transition(box-shadow, 0.2s, ease-in-out);
}
}
.clickable{
cursor: pointer;
}
\ No newline at end of file
cursor: pointer;
}
<html>
<% include partials/head %>
<body>
<div class="page-wrap">
<div class="clearfix padding-horizontal">
<div class="float-right">
<% if (!user) { %>
<a href="/login">Entrar</a>
<% } %>
<% if (user) { %>
<a href="/conta">Sua conta</a>
<% if (user.moderador) { %>
<span>|</span>
<a href="/admin">Admin</a>
<% } %>
<% } %>
</div>
<section class="index">
<h1>Farol</h1>
<form method="post" action="/search">
<input type="search" placeholder="O que você procura?" name="query"
class="search-bar two-thirds" autofocus required>
<!-- Value do submit foi retirado daqui: http://fortawesome.github.io/Font-Awesome/cheatsheet/-->
<input type="submit" class="icon-button dark" value="&#xf002;">
</form>
</section>
<p><a id="upload" class="upload-link" href="/upload">Faça o upload de uma prova ou trabalho!</a></p>
</div>
</div>
<% include partials/footer %>
</body>
</html>
<html>
<% include partials/head %>
<% include partials/basic-header %>
<body>
<% if (message.length > 0) { %>
<div class="card margin"><%= message %></div>
<% } %>
<section class="card clearfix margin">
<div>
<h2>Login</h2>
<form method="post">
<input type="text" placeholder="Username" name="username" id="username" required>
<br>
<input type="password" placeholder="Senha" name="password" id="password" required>
<br/>
<button class="button normal" type="submit">Entrar</button>
<br>
</form>
<p>
Não tem cadastro? <a href="/signup">Criar Conta</a>
</p>
</div>
</section>
<% include partials/footer %>
</body>
</html>
<header class="header clearfix">
<h2 class="no-margin float-left">
<span class="fa">&#xf13d;</span> <a href="/">Farol</a>
</h2>
</header>
<footer class="sticky">
<p>
Feito com <span class="fa">&#xf004;</span> pelo <a href="http://pet.inf.ufpr.br">PET Computação UFPR</a><br/>
</p>
</footer>
<head>
<meta charset="UTF-8">
<title>Farol - Repositório de Provas e Trabalhos</title>
<link rel="stylesheet" href="/css/style.min.css">
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
<meta name="description" content="Farol - Repositório de provas e trabalhos dos cursos de Informática Biomédica e Ciência da Computação da UFPR">
</head>
<html>
<% include partials/head %>
<% include partials/basic-header %>
<body>
<% if (message.length > 0) { %>
<div class="card margin"><%= message %></div>
<% } %>
<section class="card clearfix margin">
<div>
<h2>Criar conta</h2>
<form method="post">
<input type="text" placeholder="Nome" name="nome" required>
<br>
<input type="text" placeholder="Username" name="username" required>
<br>
<input type="text" placeholder="E-mail" name="email" required>
<br>
<input type="password" placeholder="Senha" name="password" required>
<br/>
<button class="button normal" type="submit">Criar conta</button>
<br>
</form>
<p>
Já tem uma conta? <a href="/login">Entrar</a>
</p>
</div>
</section>
<% include partials/footer %>
</body>
</html>
......@@ -4,7 +4,7 @@ var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var paths = {
sass: ['./scss/**/*.scss']
sass: ['./client/scss/**/*.scss']
};
gulp.task('default', ['sass', 'watch']);
......
......@@ -6,6 +6,8 @@ var passport = require('passport')
var methodOverride = require('method-override')
var cors = require('cors')
var compression = require('compression')
var session = require('express-session')
var flash = require('connect-flash')
var libs = process.cwd() + '/libs/'
require(libs + 'auth/auth')
......@@ -14,34 +16,45 @@ var config = require('./config')
var log = require('./log')(module)
var oauth2 = require('./auth/oauth2')
var api = require('./routes/api')
var usuarios = require('./routes/usuarios')
var materias = require('./routes/materias')
var professores = require('./routes/professores')
var arquivos = require('./routes/arquivos')
var rotas = require('./routes/routes')
var api = require('./routes/api/api')
var usuarios = require('./routes/api/usuarios')
var materias = require('./routes/api/materias')
var professores = require('./routes/api/professores')
var arquivos = require('./routes/api/arquivos')
var app = express()
app.set('json spaces', 2)
app.set('view engine', 'ejs')
app.set('views', process.cwd() + '/client/views')
app.use(express.static('client/public'))
app.use('/bower_components', express.static('bower_components'))
app.use(compression({level: 9}))
app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(methodOverride())
app.use(session({secret: 'KeepItSecret'}))
app.use(passport.initialize())
app.set('json spaces', 2)
app.use(passport.session())
app.use(flash())
app.use(express.static('client/public'))
// Rotas da aplicação
app.use('/', rotas)
// Pasta pública onde ficam os uploads
app.use('/uploads', express.static('uploads'))
// Rotas da API REST
app.use('/api/*', cors())
app.use('/api/', api)
app.use('/api/v1/u', usuarios)
app.use('/api/v1/materias', materias)
app.use('/api/v1/professores', professores)
app.use('/api/v1/arquivos', arquivos)
app.use('/api/v1/oauth/token', oauth2.token)
app.use('/api/u', usuarios)
app.use('/api/materias', materias)
app.use('/api/professores', professores)
app.use('/api/arquivos', arquivos)
app.use('/api/oauth/token', oauth2.token)
// catch 404 and forward to error handler
app.use(function(req, res, next){
......
......@@ -70,3 +70,64 @@ passport.use(new BearerStrategy(
})
}
))
var LocalStrategy = require('passport-local').Strategy
passport.serializeUser(function(user, done) {
done(null, user.id)
})
passport.deserializeUser(function(id, done) {
Usuario.findById(id, function(err, user) {
done(err, user)
})
})
passport.use('local-signup', new LocalStrategy({
passReqToCallback: true
}, function(req, username, password, done) {
process.nextTick(function() {
Usuario.findOne({'username': username}, function(err, user) {
if(err) {