remove code, fix animation reset

This commit is contained in:
ntr 2019-09-12 11:41:53 +10:00
parent 1f5d57a276
commit 9a70c1f34e
5 changed files with 20 additions and 30 deletions

View File

@ -53,13 +53,19 @@ function Welcome() {
<section> <section>
<div class="news"> <div class="news">
<h1>mnml.gg</h1> <h1>mnml.gg</h1>
<p>mnml is a turn-based 1v1 strategy game in an abstract setting.</p> <p>
<p>outplay your opponents by building your team of 3 constructs from a shifting meta of skills, effects and specialisations.</p> mnml is a turn-based 1v1 strategy game in an abstract setting.<br />
<p>simple rules, complex interactions, simultaneous turns to increase the pace, and a unique speed mechanic;</p> outplay your opponents by building your team of 3 constructs from a shifting meta of skills, effects and specialisations.<br />
<p>mnml is a tactical game unlike any other.</p> </p>
<p>free to play</p> <p>
<p>no email required</p> simple rules, complex interactions, simultaneous turns to increase the pace, and a unique speed mechanic;<br />
<p>glhf</p> mnml is a tactical game unlike any other.
</p>
<p>
free to play<br />
no email required<br />
glhf
</p>
</div> </div>
{pageEl()} {pageEl()}
</section> </section>

View File

@ -12,8 +12,8 @@ const addState = connect(
ws ws
} = state; } = state;
function submitRegister(name, password, code) { function submitRegister(name, password) {
postData('/account/register', { name, password, code }) postData('/account/register', { name, password })
.then(res => res.json()) .then(res => res.json())
.then(data => { .then(data => {
if (data.error) return errorToast(data.error); if (data.error) return errorToast(data.error);
@ -34,12 +34,11 @@ function Register(args) {
submitRegister, submitRegister,
} = args; } = args;
const { password, confirm, name, code } = this.state; const { password, confirm, name } = this.state;
const registerSubmit = (event) => { const registerSubmit = (event) => {
event.preventDefault(); event.preventDefault();
submitRegister(name, password, code); submitRegister(name, password);
// this.setState({ name: '', password: '', confirm: '', code: ''});
} }
const registerConfirm = () => const registerConfirm = () =>
@ -75,14 +74,6 @@ function Register(args) {
value={this.state.confirm} value={this.state.confirm}
onInput={linkState(this, 'confirm')} onInput={linkState(this, 'confirm')}
/> />
<label for="code">Access Code</label>
<input
class="login-input"
type="text"
placeholder="code"
value={this.state.code}
onInput={linkState(this, 'code')}
/>
<button <button
class="login-btn" class="login-btn"
disabled={registerDisabled()} disabled={registerDisabled()}

View File

@ -200,6 +200,7 @@ function registerEvents(store) {
const startDemo = () => { const startDemo = () => {
console.log(initial); console.log(initial);
store.dispatch(actions.setDemo(initial)); store.dispatch(actions.setDemo(initial));
store.dispatch(actions.setAnimTarget(null));
setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0] }))), 2000); setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0] }))), 2000);
setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0, 1] }))), 4000); setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0, 1] }))), 4000);
setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0, 1, 2] }))), 6000); setTimeout(() => store.dispatch(actions.setDemo(Object.assign({}, initial, { combiner: [0, 1, 2] }))), 6000);

View File

@ -288,15 +288,11 @@ pub fn set_subscribed(tx: &mut Transaction, id: Uuid, subscribed: bool) -> Resul
Ok(name) Ok(name)
} }
pub fn create(name: &String, password: &String, code: &String, tx: &mut Transaction) -> Result<String, MnmlHttpError> { pub fn create(name: &String, password: &String, tx: &mut Transaction) -> Result<String, MnmlHttpError> {
if password.len() < PASSWORD_MIN_LEN { if password.len() < PASSWORD_MIN_LEN {
return Err(MnmlHttpError::PasswordUnacceptable); return Err(MnmlHttpError::PasswordUnacceptable);
} }
if code.to_lowercase() != "grep842" {
return Err(MnmlHttpError::InvalidCode);
}
if name.len() == 0 { if name.len() == 0 {
return Err(MnmlHttpError::AccountNameNotProvided); return Err(MnmlHttpError::AccountNameNotProvided);
} }

View File

@ -52,8 +52,6 @@ pub enum MnmlHttpError {
PasswordUnacceptable, PasswordUnacceptable,
#[fail(display="incorrect token. refresh or logout of existing sessions")] #[fail(display="incorrect token. refresh or logout of existing sessions")]
TokenDoesNotMatch, TokenDoesNotMatch,
#[fail(display="invalid code. https://discord.gg/YJJgurM")]
InvalidCode,
} }
impl From<bcrypt::BcryptError> for MnmlHttpError { impl From<bcrypt::BcryptError> for MnmlHttpError {
@ -129,7 +127,6 @@ impl From<MnmlHttpError> for IronError {
MnmlHttpError::PasswordUnacceptable => (m_err.compat(), status::BadRequest), MnmlHttpError::PasswordUnacceptable => (m_err.compat(), status::BadRequest),
MnmlHttpError::PasswordNotMatch | MnmlHttpError::PasswordNotMatch |
MnmlHttpError::InvalidCode |
MnmlHttpError::TokenDoesNotMatch | MnmlHttpError::TokenDoesNotMatch |
MnmlHttpError::Unauthorized => (m_err.compat(), status::Unauthorized), MnmlHttpError::Unauthorized => (m_err.compat(), status::Unauthorized),
@ -211,7 +208,6 @@ fn token_res(token: String) -> Response {
struct RegisterBody { struct RegisterBody {
name: String, name: String,
password: String, password: String,
code: String,
} }
fn register(req: &mut Request) -> IronResult<Response> { fn register(req: &mut Request) -> IronResult<Response> {
@ -224,7 +220,7 @@ fn register(req: &mut Request) -> IronResult<Response> {
let db = state.pool.get().or(Err(MnmlHttpError::DbError))?; let db = state.pool.get().or(Err(MnmlHttpError::DbError))?;
let mut tx = db.transaction().or(Err(MnmlHttpError::DbError))?; let mut tx = db.transaction().or(Err(MnmlHttpError::DbError))?;
match account::create(&params.name, &params.password, &params.code, &mut tx) { match account::create(&params.name, &params.password, &mut tx) {
Ok(token) => { Ok(token) => {
tx.commit().or(Err(MnmlHttpError::ServerError))?; tx.commit().or(Err(MnmlHttpError::ServerError))?;
Ok(token_res(token)) Ok(token_res(token))