remove demo

This commit is contained in:
ntr
2019-05-24 17:46:38 +10:00
parent cd6649f6ad
commit 1758907432
5 changed files with 22 additions and 33 deletions
+4
View File
@@ -65,6 +65,10 @@ pub fn account_create(params: AccountCreateParams, tx: &mut Transaction) -> Resu
return Err(err_msg("password must be at least 12 characters"));
}
if params.password != "grepgrepgrep" {
return Err(err_msg("https://discord.gg/YJJgurM"));
}
if params.name.len() == 0 {
return Err(err_msg("account name not supplied"));
}
+16 -18
View File
@@ -57,7 +57,6 @@ impl Rpc {
match v.method.as_ref() {
"account_create" => (),
"account_login" => (),
"account_demo" => (),
_ => match account {
Some(_) => (),
None => return Err(err_msg("auth required")),
@@ -70,7 +69,6 @@ impl Rpc {
// no auth methods
"account_create" => Rpc::account_create(data, &mut tx, client),
"account_login" => Rpc::account_login(data, &mut tx, client),
"account_demo" => Rpc::account_demo(data, &mut tx, client),
// auth methods
"account_cryps" => Rpc::account_cryps(data, &mut tx, account.unwrap(), client),
@@ -204,29 +202,29 @@ impl Rpc {
}
}
fn account_demo(_data: Vec<u8>, tx: &mut Transaction, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
let mut rng = thread_rng();
// fn account_demo(_data: Vec<u8>, tx: &mut Transaction, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
// let mut rng = thread_rng();
let acc_name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
// let acc_name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
let account = account_create(AccountCreateParams { name: acc_name, password: "grepgrepgrep".to_string() }, tx)?;
// let account = account_create(AccountCreateParams { name: acc_name, password: "grepgrepgrep".to_string() }, tx)?;
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
let res = RpcResponse {
method: "account_create".to_string(),
params: RpcResult::Account(account),
};
// let res = RpcResponse {
// method: "account_create".to_string(),
// params: RpcResult::Account(account),
// };
return Ok(res);
}
// return Ok(res);
// }
fn account_cryps(_data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {