This commit is contained in:
lesion
2019-06-08 13:18:47 +02:00
parent c408c44676
commit d6501b1a5b
17 changed files with 63 additions and 34 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
# Created by .ignore support plugin (hsz.mobi) # Created by .ignore support plugin (hsz.mobi)
### Gancio production configuration ### Gancio production configuration
server/config.js config.js
### Node template ### Node template
# Logs # Logs

View File

@@ -6,13 +6,32 @@
## Install ## Install
You will need `npm` or `yarn` installed in your system.
``` bash ``` bash
# clone this repo
git clone https://git.lattuga.net/cisti/gancio.git
cd gancio
# install dependencies # install dependencies
$ yarn install yarn install
# edit configuration
cp config.example.js config.js
# - migrate/create test sqlite db
yarn migrate:dev
# testing with sqlite db
yarn dev
# - migrate/create production db
yarn migrate
# build for production and launch server # build for production and launch server
$ yarn build yarn build
$ yarn start yarn start
``` ```
@@ -27,8 +46,4 @@ For detailed explanation on how things work, checkout [Nuxt.js docs](https://nux
``` bash ``` bash
$ yarn dev $ yarn dev
``` ```
#### Add a new icon
plugin/vue-awesome.js

View File

@@ -51,9 +51,8 @@ const SHARED_CONF = {
locale: 'it', locale: 'it',
title: 'GANCIO', title: 'GANCIO',
description: 'A calendar for radical communities', description: 'A calendar for radical communities',
baseurl: '' || 'http://localhost:3000',
baseurl: env === 'development' ? 'http://localhost:3000': 'https://gancio.example.com',
env env
} }
module.exports = { SHARED_CONF, SECRET_CONF } module.exports = { SHARED_CONF, SECRET_CONF, ...SECRET_CONF.db }

View File

@@ -1,5 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"recover_email": "recover_email", "recover_email": "recover_email",
"press here": "press here" "press here": "press here",
"register.request": "register.request"
} }

View File

@@ -1,5 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"recover_email": "recover_email", "recover_email": "recover_email",
"press here": "press here" "press here": "press here",
"register.request": "register.request"
} }

View File

@@ -1,5 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"recover_email": "recover_email", "recover_email": "recover_email",
"press here": "press here" "press here": "press here",
"register.request": "register.request"
} }

View File

@@ -1,5 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"recover_email": "recover_email", "recover_email": "recover_email",
"press here": "press here" "press here": "press here",
"register.request": "register.request"
} }

View File

@@ -39,7 +39,9 @@ const it = {
related: 'Memoria storica', related: 'Memoria storica',
add: 'Aggiungi', add: 'Aggiungi',
logout_ok: 'Uscita correttamente', logout_ok: 'Uscita correttamente',
copy: 'Copia' copy: 'Copia',
recover_password: 'Recupera password',
new_password: 'Nuova password'
}, },
login: { login: {
@@ -77,7 +79,10 @@ const it = {
carne e sangue, scrivici quindi due righe per farci capire che eventi vorresti pubblicare.`, carne e sangue, scrivici quindi due righe per farci capire che eventi vorresti pubblicare.`,
error: 'Errore: ', error: 'Errore: ',
admin_complete: 'Sei il primo utente e quindi sei amministratore!', admin_complete: 'Sei il primo utente e quindi sei amministratore!',
complete: 'Confermeremo la registrazione quanto prima.' complete: 'Confermeremo la registrazione quanto prima.',
request: 'Richiesta di registrazione',
registration_email: `Ciao,
ci è arrivata una richiesta di registrazione su gancio, la confermeremo quanto prima.`
}, },
event: { event: {

View File

@@ -9,7 +9,9 @@
"start": "cross-env NODE_ENV=production node server/index.js", "start": "cross-env NODE_ENV=production node server/index.js",
"generate": "nuxt generate", "generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint" "precommit": "npm run lint",
"migrate:dev": "sequelize db:migrate",
"migrate": "NODE_ENV=production sequelize db:migrate"
}, },
"bin": { "bin": {
"gancio": "server/index.js" "gancio": "server/index.js"

View File

@@ -1,9 +1,5 @@
<template lang="pug"> <template lang="pug">
el-card#eventDetail( el-card#eventDetail
visible hide-header
no-header :show-close='false'
top='0vh !important'
:appendToBody='true')
//- close button //- close button
nuxt-link.float-right(to='/') nuxt-link.float-right(to='/')

View File

@@ -1,7 +1,9 @@
<template lang="pug"> <template lang="pug">
el-dialog(visible) el-card
template(slot='title') nuxt-link.float-right(to='/')
h5 <img src='/favicon.ico'/> {{$t('common.recover_password')}} el-button(circle icon='el-icon-close' type='danger' size='small' plain)
h5 <img src='/favicon.ico'/> {{$t('common.recover_password')}}
div(v-if='valid') div(v-if='valid')
el-form el-form
el-form-item {{$t('common.new_password')}} el-form-item {{$t('common.new_password')}}

View File

@@ -8,6 +8,7 @@ const mail = {
send(addresses, template, locals) { send(addresses, template, locals) {
const email = new Email({ const email = new Email({
views: { root: path.join(__dirname, '..', 'emails') }, views: { root: path.join(__dirname, '..', 'emails') },
htmlToText: false,
juice: true, juice: true,
juiceResources: { juiceResources: {
preserveImportant: true, preserveImportant: true,
@@ -25,7 +26,7 @@ const mail = {
}, },
transport: config.SECRET_CONF.smtp transport: config.SECRET_CONF.smtp
}) })
return email.send({ const msg = {
template, template,
message: { message: {
to: addresses, to: addresses,
@@ -37,7 +38,11 @@ const mail = {
config: config.SHARED_CONF, config: config.SHARED_CONF,
datetime: datetime => moment(datetime).format('ddd, D MMMM HH:mm') datetime: datetime => moment(datetime).format('ddd, D MMMM HH:mm')
} }
}) }
return email.send(msg)
.catch(e => {
console.error(e)
})
} }
} }

View File

@@ -5,7 +5,7 @@ module.exports = (sequelize, DataTypes) => {
const user = sequelize.define('user', { const user = sequelize.define('user', {
email: { email: {
type: DataTypes.STRING, type: DataTypes.STRING,
unique: { msg: 'err.register_error' }, unique: true,
index: true, index: true,
allowNull: false allowNull: false
}, },
@@ -16,7 +16,7 @@ module.exports = (sequelize, DataTypes) => {
is_active: DataTypes.BOOLEAN is_active: DataTypes.BOOLEAN
}, { }, {
defaultScope: { defaultScope: {
exclude: ['password', 'recover_code'] attributes: { exclude: ['password', 'recover_code'] }
} }
}) })

View File

@@ -1,3 +1,3 @@
p= t('recover_email') p= t('mail.recover')
<a href="#{config.baseurl}/recover/#{user.recover_code}">#{t('press here')}</a> <a href="#{config.baseurl}/recover/#{user.recover_code}">#{t('press here')}</a>

View File

@@ -1 +1 @@
= `[Gancio] Richiesta registrazione` | [Gancio] #{t('register.request')}

View File

@@ -0,0 +1 @@
| dioicane ciao

View File

@@ -10,7 +10,7 @@ module.exports = {
}, },
email: { email: {
type: Sequelize.STRING, type: Sequelize.STRING,
unique: { msg: 'err.register_error' }, unique: true,
index: true, index: true,
allowNull: false allowNull: false
}, },