Compare commits
No commits in common. "c947acf8bb7bfbb3fc1de0ea4c6f354fee5dba50" and "be61601950236dc6dee40054945f6e58c17104f8" have entirely different histories.
c947acf8bb
...
be61601950
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" src="style.css" />
|
|
||||||
<title>Contact mailer admin interface</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<main id="app">
|
|
||||||
<section>
|
|
||||||
<h3>Athentification</h3>
|
|
||||||
<div v-if="!loggedin" class="loginform">
|
|
||||||
<form v-on:submit.prevent="login">
|
|
||||||
<select v-model="type">
|
|
||||||
<option value="token">Utilisateur</option>
|
|
||||||
<option value="admin_pass">Administrateur</option>
|
|
||||||
</select>
|
|
||||||
<input type="password" v-model="password" />
|
|
||||||
<input type="submit" value="connect" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div v-else="">
|
|
||||||
<p>Connecté en tant que {{ type }}</p>
|
|
||||||
<button v-on:click="logout">Se déconnecter</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<div v-if="loggedin && type=='admin_pass'">
|
|
||||||
<h3>Utilisateurices</h3>
|
|
||||||
<form v-on:submit.prevent="addUser">
|
|
||||||
<input type="text" v-model="newUser" />
|
|
||||||
<input type="submit" />
|
|
||||||
</form>
|
|
||||||
<button v-on:click="getUsers">Rafraichir les utilisateurs</button>
|
|
||||||
<ul>
|
|
||||||
<li v-for="user in users">{{user.token}} — {{user.username}}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<h3>Formulaires</h3>
|
|
||||||
<button v-on:click="getForms">Rafraichir les formulaires</button>
|
|
||||||
<ul>
|
|
||||||
<li v-for="form in forms">
|
|
||||||
<div>À {{form.mail}}</div>
|
|
||||||
<div>Objet {{form.subject}}</div>
|
|
||||||
<div>{{form.content}}</div>
|
|
||||||
<div>{{form.token}} — {{form.honeypotfield}} — {{form.timerdelay}}</div>
|
|
||||||
<button v-on:click="deleteForm(form.token)">Supprimer</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div v-if="page=='new_user'">
|
|
||||||
<form v-on:submit.prevent="addForm">
|
|
||||||
<label for="mail">Mail :</label>
|
|
||||||
<input v-model="newForm.mail" type="text" name="mail" id="mail" />
|
|
||||||
<br />
|
|
||||||
<label for="content">Contenu :</label>
|
|
||||||
<textarea v-model="newForm.content" name="content" id="content">
|
|
||||||
</textarea>
|
|
||||||
<br />
|
|
||||||
<label for="subject">Objet :</label>
|
|
||||||
<input v-model="newForm.subject" type="text" name="subject" id="subject" />
|
|
||||||
<br />
|
|
||||||
<label for="honeypot">Honeypot (ne pas toucher) :</label>
|
|
||||||
<input v-model="newForm.honeypotfield" type="text" name="honeypot" id="honeypot" />
|
|
||||||
<br />
|
|
||||||
<label for="timerdelay">Timer delay :</label>
|
|
||||||
<input v-model="newForm.timerdelay" type="number" name="timerdelay" id="timerdelay" />
|
|
||||||
<br />
|
|
||||||
<input type="submit" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
<script src="./vue.js"></script>
|
|
||||||
<script src="./index.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
124
adminer/index.js
124
adminer/index.js
@ -1,124 +0,0 @@
|
|||||||
var app = new Vue({
|
|
||||||
el: '#app',
|
|
||||||
data: {
|
|
||||||
type: 'admin_pass', /* admin_pass or token */
|
|
||||||
password: 'test',
|
|
||||||
loggedin: false,
|
|
||||||
mailerHost: 'https://mailer.jean-cloud.net',
|
|
||||||
//mailerHost: 'http://localhost:8080',
|
|
||||||
//mailerHost: '/api',
|
|
||||||
forms: [],
|
|
||||||
users: [],
|
|
||||||
newUser: '',
|
|
||||||
page:'new_user',
|
|
||||||
newForm: {
|
|
||||||
'content': '{{message}}',
|
|
||||||
'subject': '[contact jean-cloud.net] {{nom|annonyme}} — {{objet}}',
|
|
||||||
'mail': 'contact@jean-cloud.org',
|
|
||||||
'honeypotfield': 'prenom',
|
|
||||||
'timerdelay': 5,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
login: function () {
|
|
||||||
if (!this.type) {
|
|
||||||
console.log('missing type')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.password) {
|
|
||||||
console.log('missing password')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.loggedin = true
|
|
||||||
this.getForms()
|
|
||||||
if ( this.type == 'admin_pass' )
|
|
||||||
this.getUsers()
|
|
||||||
},
|
|
||||||
logout: function () {
|
|
||||||
this.type = 'token'
|
|
||||||
this.password = null
|
|
||||||
this.loggedin = false
|
|
||||||
},
|
|
||||||
getForms: function () {
|
|
||||||
fetch(this.mailerHost + '/form/list', {
|
|
||||||
method: 'POST',
|
|
||||||
body: this.type + '=' + this.password
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.status != 'success')
|
|
||||||
console.error('getForms error: '+data.msg)
|
|
||||||
else
|
|
||||||
this.forms = data.data
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getUsers: function () {
|
|
||||||
fetch(this.mailerHost + '/user/list', {
|
|
||||||
method: 'POST',
|
|
||||||
body: this.type + '=' + this.password
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.status != 'success')
|
|
||||||
console.error('getForms error: '+data.msg)
|
|
||||||
else
|
|
||||||
this.users = data.data
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
addForm: function () {
|
|
||||||
fetch(this.mailerHost + '/form', {
|
|
||||||
method: 'post',
|
|
||||||
body: this.type + '=' + this.password
|
|
||||||
+ '&subject=' + this.newForm.subject
|
|
||||||
+ '&mail=' + this.newForm.mail
|
|
||||||
+ '&content=' + this.newForm.content
|
|
||||||
+ '&honeypotfield=' + this.newForm.honeypotfield
|
|
||||||
+ '&timerdelay=' + this.newForm.timerdelay
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
console.log(data)
|
|
||||||
this.getForms()
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.log(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
addUser: function () {
|
|
||||||
if (!this.newUser) {
|
|
||||||
console.log('need username')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fetch(this.mailerHost + '/user/' + this.newUser, {
|
|
||||||
method: 'put',
|
|
||||||
body: this.type + '=' + this.password
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
this.newUser = ''
|
|
||||||
this.getUsers()
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error)
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
deleteForm: function (formId) {
|
|
||||||
fetch(this.mailerHost + '/form/' + formId, {
|
|
||||||
method: 'delete',
|
|
||||||
body: this.type + '=' + this.password
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
console.log(data)
|
|
||||||
this.getForms()
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
11965
adminer/vue.js
11965
adminer/vue.js
File diff suppressed because it is too large
Load Diff
38
nginx.conf
38
nginx.conf
@ -1,38 +0,0 @@
|
|||||||
worker_processes auto;
|
|
||||||
include /etc/nginx/modules-enabled/*.conf;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 768;
|
|
||||||
# multi_accept on;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
sendfile on;
|
|
||||||
tcp_nopush on;
|
|
||||||
tcp_nodelay on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
error_log stderr;
|
|
||||||
access_log /dev/stdout;
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
types_hash_max_size 2048;
|
|
||||||
types_hash_bucket_size 128;
|
|
||||||
gzip on;
|
|
||||||
|
|
||||||
server {
|
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, OPTIONS';
|
|
||||||
listen 8008;
|
|
||||||
location /admin {
|
|
||||||
root /home/ilya/git/contact_mailer/adminer;
|
|
||||||
index index.html;
|
|
||||||
}
|
|
||||||
location / {
|
|
||||||
root /home/ilya/git/contact_mailer;
|
|
||||||
index test.html;
|
|
||||||
}
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://localhost:8080/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user