more renaming
This commit is contained in:
parent
6a20e72a64
commit
7e2a95204e
@ -13,13 +13,13 @@ function renderLogin({ submitLogin, submitRegister }) {
|
||||
className="login-input"
|
||||
type="email"
|
||||
placeholder="username"
|
||||
onChange={e => (details.name = e.target.value)}
|
||||
onInput={e => details.name = e.target.value}
|
||||
/>
|
||||
<input
|
||||
className="login-input"
|
||||
type="password"
|
||||
placeholder="password"
|
||||
onChange={e => (details.password = e.target.value)}
|
||||
onInput={e => details.password = e.target.value}
|
||||
/>
|
||||
<button
|
||||
className="login-btn"
|
||||
|
||||
@ -9,6 +9,7 @@ const addState = connect(
|
||||
return ws.sendAccountLogin(name, password);
|
||||
}
|
||||
function submitRegister(name, password) {
|
||||
console.log(name, password);
|
||||
return ws.sendAccountCreate(name, password);
|
||||
}
|
||||
return { account: state.account, submitLogin, submitRegister };
|
||||
|
||||
@ -13,7 +13,6 @@ class SpawnButton extends Component {
|
||||
}
|
||||
|
||||
handleInput(event) {
|
||||
console.log(event.target.value);
|
||||
this.setState({ value: event.target.value });
|
||||
}
|
||||
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
# sudo apt-get install -y postgresql postgresql-contrib
|
||||
sudo service postgresql start
|
||||
sudo -u postgres dropdb constructs
|
||||
sudo -u postgres createdb constructs
|
||||
sudo -u postgres createuser --enconstructted constructs
|
||||
sudo -u postgres psql -c "alter user constructs with enconstructted password 'craftbeer';"
|
||||
sudo -u postgres dropdb mnml
|
||||
sudo -u postgres createdb mnml
|
||||
sudo -u postgres createuser --encrypted mnml
|
||||
sudo -u postgres psql -c "alter user mnml with encrypted password 'craftbeer';"
|
||||
|
||||
# npm i
|
||||
npm run migrate
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
const local = {
|
||||
client: 'postgresql',
|
||||
connection: {
|
||||
database: 'constructs',
|
||||
user: 'constructs',
|
||||
database: 'mnml',
|
||||
user: 'mnml',
|
||||
password: 'craftbeer'
|
||||
},
|
||||
pool: {
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
exports.up = async knex => {
|
||||
await knex.schema.createTable('games', table => {
|
||||
table.uuid('id').primary();
|
||||
@ -67,14 +65,6 @@ exports.up = async knex => {
|
||||
.inTable('games')
|
||||
.onDelete('NO ACTION');
|
||||
});
|
||||
|
||||
|
||||
// not really sure if this is a good idea
|
||||
await knex('instances').insert({
|
||||
id: NULL_UUID,
|
||||
data: 'INVALID',
|
||||
open: false,
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async () => {};
|
||||
@ -1,28 +0,0 @@
|
||||
exports.up = async knex => {
|
||||
await knex.schema.createTable('zones', async (table) => {
|
||||
table.uuid('id').primary();
|
||||
table.index('id');
|
||||
table.timestamps(true, true);
|
||||
|
||||
table.binary('data').notNullable();
|
||||
|
||||
table.boolean('active')
|
||||
.defaultTo(true)
|
||||
.notNullable();
|
||||
|
||||
table.uuid('account').notNullable()
|
||||
table.foreign('account')
|
||||
.references('id')
|
||||
.inTable('accounts')
|
||||
.onDelete('CASCADE');
|
||||
|
||||
table.index('account');
|
||||
|
||||
await knex.schema.raw(
|
||||
// eslint-disable-next-line max-len
|
||||
'CREATE UNIQUE INDEX zones_account_active ON zones (account) WHERE active = true;'
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async () => {};
|
||||
@ -8,7 +8,7 @@ map $http_upgrade $connection_upgrade {
|
||||
}
|
||||
|
||||
server {
|
||||
root /home/git/constructs/client/dist/;
|
||||
root /home/git/cryps/client/dist/;
|
||||
index index.html;
|
||||
|
||||
server_name mnml.gg; # managed by Certbot
|
||||
@ -23,10 +23,10 @@ server {
|
||||
|
||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||
listen 443 ssl; # managed by Certbot
|
||||
ssl_certificate /etc/letsenconstructt/live/mnml.gg/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsenconstructt/live/mnml.gg/privkey.pem; # managed by Certbot
|
||||
include /etc/letsenconstructt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsenconstructt/ssl-dhparams.pem; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/mnml.gg/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/mnml.gg/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://mnml;
|
||||
@ -37,6 +37,7 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# http -> https
|
||||
server {
|
||||
server_name mnml.gg;
|
||||
return 301 https://$host$request_uri;
|
||||
@ -48,6 +49,6 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
server_name constructs.gg;
|
||||
server_name cryps.gg;
|
||||
return 301 https://mnml.gg$request_uri;
|
||||
}
|
||||
@ -1 +1 @@
|
||||
DATABASE_URL=postgres://constructs:craftbeer@localhost/constructs
|
||||
DATABASE_URL=postgres://mnml:craftbeer@localhost/mnml
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "constructs"
|
||||
name = "mnml"
|
||||
version = "0.1.0"
|
||||
authors = ["ntr <ntr@smokestack.io>"]
|
||||
|
||||
@ -13,7 +13,7 @@ serde_cbor = "0.9"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
tungstenite = "0.6"
|
||||
bconstructt = "0.2"
|
||||
bcrypt = "0.2"
|
||||
|
||||
dotenv = "0.9.0"
|
||||
postgres = { version = "0.15", features = ["with-uuid"] }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use uuid::Uuid;
|
||||
use bconstructt::{hash, verify};
|
||||
use bcrypt::{hash, verify};
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use std::iter;
|
||||
@ -15,7 +15,7 @@ use instance::{Instance, instance_delete};
|
||||
use failure::Error;
|
||||
use failure::err_msg;
|
||||
|
||||
static PASSWORD_MIN_LEN: usize = 12;
|
||||
static PASSWORD_MIN_LEN: usize = 11;
|
||||
|
||||
#[derive(Debug,Clone,Serialize,Deserialize)]
|
||||
pub struct Account {
|
||||
@ -61,6 +61,7 @@ pub fn account_from_token(token: String, tx: &mut Transaction) -> Result<Account
|
||||
pub fn account_create(params: AccountCreateParams, tx: &mut Transaction) -> Result<Account, Error> {
|
||||
let id = Uuid::new_v4();
|
||||
|
||||
info!("{:?} {:?}", params.password, params.password.len());
|
||||
if params.password.len() < PASSWORD_MIN_LEN {
|
||||
return Err(err_msg("password must be at least 12 characters"));
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
extern crate rand;
|
||||
extern crate uuid;
|
||||
extern crate tungstenite;
|
||||
extern crate bconstructt;
|
||||
extern crate bcrypt;
|
||||
extern crate chrono;
|
||||
|
||||
extern crate dotenv;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user