add registry code

This commit is contained in:
ntr 2019-06-11 17:44:24 +10:00
parent 440376e5c3
commit 1faf75bb40
7 changed files with 36 additions and 15 deletions

View File

@ -114,11 +114,15 @@ nav button[disabled], nav button[disabled]:hover {
text-decoration: none;
}
nav button:hover, nav button:focus {
color: whitesmoke;
nav button:hover {
color: #888;
text-decoration: underline;
}
nav button:focus, nav button:active {
color: whitesmoke;
}
main {
padding-top: 1em;
grid-area: main;
@ -154,7 +158,12 @@ button, input {
transition-timing-function: ease;
}
button:hover, button:focus {
button:hover {
color: whitesmoke;
border-color: #888;
}
button:focus {
/*colour necesary to bash skellington*/
color: whitesmoke;
border-color: whitesmoke;

View File

@ -58,7 +58,7 @@ class InstanceCreateForm extends Component {
<form>
<fieldset>
<legend>New Instance</legend>
<label>instance name</label>
<label>Instance Name</label>
<input
class="login-input"
type="text"
@ -67,7 +67,7 @@ class InstanceCreateForm extends Component {
placeholder="game name"
onInput={this.nameInput}
/>
<label htmlFor="pveSelect">Practice Mode - vs CPU, no time control</label>
<label htmlFor="pveSelect">Practice Mode - vs CPU, no Time Control</label>
<input id="pveSelect"
type="checkbox"
disabled={disabled}

View File

@ -9,9 +9,8 @@ const addState = connect(
function submitLogin(name, password) {
return ws.sendAccountLogin(name, password);
}
function submitRegister(name, password) {
console.log(name, password);
return ws.sendAccountCreate(name, password);
function submitRegister(name, password, code) {
return ws.sendAccountCreate(name, password, code);
}
return { account, submitLogin, submitRegister };
},
@ -21,10 +20,11 @@ class Login extends Component {
constructor(props) {
super(props);
this.state = { name: '', password: '' };
this.state = { name: '', password: '', code: ''};
this.nameInput = this.nameInput.bind(this);
this.passwordInput = this.passwordInput.bind(this);
this.codeInput = this.codeInput.bind(this);
this.loginSubmit = this.loginSubmit.bind(this);
this.registerSubmit = this.registerSubmit.bind(this);
}
@ -37,6 +37,10 @@ class Login extends Component {
this.setState({ password: event.target.value });
}
codeInput(event) {
this.setState({ code: event.target.value });
}
loginSubmit(event) {
event.preventDefault();
console.log(this.state);
@ -46,9 +50,9 @@ class Login extends Component {
registerSubmit(event) {
event.preventDefault();
this.props.submitRegister(this.state.name, this.state.password);
this.props.submitRegister(this.state.name, this.state.password, this.state.code);
console.log(this.state);
this.setState({ name: '', password: '' });
this.setState({ name: '', password: '', code: ''});
}
@ -70,6 +74,13 @@ class Login extends Component {
value={this.state.password}
onInput={this.passwordInput}
/>
<input
class="login-input"
type="text"
placeholder="code"
value={this.state.code}
onInput={this.codeInput}
/>
<button
class="login-btn"
onClick={this.loginSubmit}>

View File

@ -146,7 +146,7 @@ function Nav(args) {
<h1 class="header-title">mnml.gg</h1>
{accountStatus}
<button onClick={() => navTo('team')}>Select Team</button>
<button disabled={canJoin} onClick={() => navTo('list')}>Join</button>
<button disabled={canJoin} onClick={() => navTo('list')}>Play</button>
<hr />
{joined}
{haxSection}

View File

@ -43,8 +43,8 @@ function createSocket(events) {
send({ method: 'account_login', params: { name, password } });
}
function sendAccountCreate(name, password) {
send({ method: 'account_create', params: { name, password } });
function sendAccountCreate(name, password, code) {
send({ method: 'account_create', params: { name, password, code } });
}
function sendAccountConstructs() {

View File

@ -65,7 +65,7 @@ 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" {
if params.code.to_lowercase() != "grep842" {
return Err(err_msg("https://discord.gg/YJJgurM"));
}

View File

@ -472,6 +472,7 @@ struct AccountCreateMsg {
pub struct AccountCreateParams {
pub name: String,
pub password: String,
pub code: String,
}
#[derive(Debug,Clone,Serialize,Deserialize)]