password changes, account name restrictions

This commit is contained in:
ntr 2019-11-12 15:20:02 +11:00
parent 357c38e375
commit 87bc63e648
6 changed files with 106 additions and 54 deletions

View File

@ -6,10 +6,13 @@
* can't reset password without knowing password =\
* ws gzip encoding
* mobile info page
* Graphics
* Img
* Skill Icons
* Buttons / General UI Theming
* Front Page
## SOON
* supporter gold name in instance (anyone whos put any money into game)
* change cooldowns to delay & recharge
@ -59,7 +62,7 @@
* Items
* instead of red noise, red and black bar gradient
* eth adapter
*sets*
*sets*
* illusions
* vaporwave
* crop circles

View File

@ -2457,9 +2457,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="0.53357639"
inkscape:cx="411.32817"
inkscape:cy="1018.5983"
inkscape:zoom="0.53546627"
inkscape:cx="561.25984"
inkscape:cy="793.70079"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
@ -2538,17 +2538,10 @@
id="layer1"
transform="translate(-472.60042,755.1467)"
style="display:inline">
<rect
style="opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:3.01528859;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect5015"
width="297"
height="420"
x="472.60043"
y="-755.14679" />
<g
id="g4946"
style="stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none"
transform="translate(0,24.99999)">
transform="translate(0,2.7646743)">
<path
inkscape:connector-curvature="0"
id="path4913"
@ -2566,28 +2559,69 @@
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<g
id="g5001"
transform="translate(25)">
id="g5142"
transform="translate(0,-47.235375)">
<g
transform="translate(25)"
id="g5001">
<path
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:3;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 522.60042,-435.14668 v -75.00001 h 50 v 75.00001 h -50"
id="path4948"
inkscape:connector-curvature="0" />
<path
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 532.60042,-500.14669 h 30 v 55 h -30 z"
id="path4978"
inkscape:connector-curvature="0" />
<path
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 542.60042,-490.1467 h 10 v 35 h -10 v -35"
id="path4988"
inkscape:connector-curvature="0" />
</g>
<path
inkscape:connector-curvature="0"
id="path4948"
d="m 522.60042,-435.14668 v -75.00001 h 50 v 75.00001 h -50"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:3;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path4978"
d="m 532.60042,-500.14669 h 30 v 55 h -30 z"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path4988"
d="m 542.60042,-490.1467 h 10 v 35 h -10 v -35"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
id="path5003"
d="m 697.60042,-460.14669 -25,25.00001 -25,-25.00001 25,25.00001 v -75.00001 h -25"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<g
id="g5123"
transform="matrix(0.23529412,0,0,0.23529412,411.40033,-377.05346)"
style="stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
<path
inkscape:connector-curvature="0"
id="path5068"
d="m 472.60042,-185.14671 v -49.99998 h 100 v 25 h -100 l 100,24.99998"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path5075"
d="m 622.60042,-185.14671 v -49.99998 h 100 v 49.99998 z"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path5082"
d="m 772.60042,-235.14669 h 99.99999 -50.00001 l 2e-5,50"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path5096"
d="m 922.60041,-185.14671 v 0 -49.99998 h 99.99999 v 49.99998 -24.99998 h -99.99999"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
inkscape:connector-curvature="0"
id="path5103"
d="m 1072.6004,-235.14669 h 100 -50 v 49.99998"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0"
id="path5110"
d="m 1322.6004,-185.14669 -100,-2e-5 v -24.99998 h 75 -75 v -25 h 100"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:12.75;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
<path
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#f5f5f5;stroke-width:2.9685142;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 697.60042,-460.14669 -25,25.00001 -25,-25.00001 25,25.00001 v -75.00001 h -25"
id="path5003"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -122,6 +122,10 @@ section {
// height: 3em;
}
&.sub {
grid-template-columns: 1fr;
}
&.play {
grid-template-columns: repeat(2, 1fr);
align-items: flex-start;

View File

@ -44,21 +44,26 @@ function BitsBtn(args) {
}
const subscription = account.subscribed
? <button
class="yellow-btn"
disabled>
Subscribed
</button>
: <button
onClick={subscribeClick}
class="yellow-btn"
role="link">
Subscribe
</button>;
? <figure>
<figcaption>Thank you for your support</figcaption>
<button
class="yellow-btn"
disabled>
Subscribed
</button>
</figure>
: <figure onClick={subscribeClick}>
<figcaption>¤150 / month + Chat Wheel + more</figcaption>
<button
class="yellow-btn"
role="link">
Subscribe
</button>
</figure>;
return (
<div>
<div class='list'>
<div class='list sub'>
{subscription}
</div>
<div class='list'>

View File

@ -22,6 +22,7 @@ use failure::Error;
use failure::{err_msg, format_err};
static PASSWORD_MIN_LEN: usize = 3;
static PASSWORD_ROUNDS: u32 = 10;
#[derive(Debug,Clone,Serialize,Deserialize)]
pub struct Account {
@ -70,11 +71,11 @@ pub fn chat_wheel(_db: &Db, _id: Uuid) -> Result<Vec<String>, Error> {
return Ok(vec![
"gg".to_string(),
"glhf".to_string(),
"hmm".to_string(),
"ok".to_string(),
"ez".to_string(),
"rekt".to_string(),
"thx".to_string(),
"nice".to_string(),
"wp".to_string(),
"ok".to_string(),
"...".to_string(),
])
}
@ -226,8 +227,7 @@ pub fn set_password(tx: &mut Transaction, id: Uuid, current: &String, password:
return Err(MnmlHttpError::BadRequest);
}
let rounds = 8;
let password = hash(&password, rounds)?;
let password = hash(&password, PASSWORD_ROUNDS)?;
let query = "
UPDATE accounts
@ -327,10 +327,13 @@ pub fn create(name: &String, password: &String, tx: &mut Transaction) -> Result<
return Err(MnmlHttpError::AccountNameNotProvided);
}
if name.len() > 20 {
return Err(MnmlHttpError::AccountNameUnacceptable);
}
let id = Uuid::new_v4();
let img = Uuid::new_v4();
let rounds = 12;
let password = hash(&password, rounds)?;
let password = hash(&password, PASSWORD_ROUNDS)?;
let mut rng = thread_rng();
let token: String = iter::repeat(())

View File

@ -44,7 +44,9 @@ pub enum MnmlHttpError {
AccountNameNotProvided,
#[fail(display="account name unavailable")]
AccountNameUnavailable,
#[fail(display="account not found")]
#[fail(display="account name unavailable")]
AccountNameUnacceptable,
#[fail(display="account name is unacceptable. 20 char max")]
AccountNotFound,
#[fail(display="password does not match")]
PasswordNotMatch,
@ -122,6 +124,7 @@ impl From<MnmlHttpError> for IronError {
MnmlHttpError::AccountNameNotProvided |
MnmlHttpError::AccountNameUnavailable |
MnmlHttpError::AccountNameUnacceptable |
MnmlHttpError::AccountNotFound |
MnmlHttpError::BadRequest |
MnmlHttpError::PasswordUnacceptable => (m_err.compat(), status::BadRequest),