remove code, fix animation reset
This commit is contained in:
@@ -288,15 +288,11 @@ pub fn set_subscribed(tx: &mut Transaction, id: Uuid, subscribed: bool) -> Resul
|
||||
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 {
|
||||
return Err(MnmlHttpError::PasswordUnacceptable);
|
||||
}
|
||||
|
||||
if code.to_lowercase() != "grep842" {
|
||||
return Err(MnmlHttpError::InvalidCode);
|
||||
}
|
||||
|
||||
if name.len() == 0 {
|
||||
return Err(MnmlHttpError::AccountNameNotProvided);
|
||||
}
|
||||
|
||||
+1
-5
@@ -52,8 +52,6 @@ pub enum MnmlHttpError {
|
||||
PasswordUnacceptable,
|
||||
#[fail(display="incorrect token. refresh or logout of existing sessions")]
|
||||
TokenDoesNotMatch,
|
||||
#[fail(display="invalid code. https://discord.gg/YJJgurM")]
|
||||
InvalidCode,
|
||||
}
|
||||
|
||||
impl From<bcrypt::BcryptError> for MnmlHttpError {
|
||||
@@ -129,7 +127,6 @@ impl From<MnmlHttpError> for IronError {
|
||||
MnmlHttpError::PasswordUnacceptable => (m_err.compat(), status::BadRequest),
|
||||
|
||||
MnmlHttpError::PasswordNotMatch |
|
||||
MnmlHttpError::InvalidCode |
|
||||
MnmlHttpError::TokenDoesNotMatch |
|
||||
MnmlHttpError::Unauthorized => (m_err.compat(), status::Unauthorized),
|
||||
|
||||
@@ -211,7 +208,6 @@ fn token_res(token: String) -> Response {
|
||||
struct RegisterBody {
|
||||
name: String,
|
||||
password: String,
|
||||
code: String,
|
||||
}
|
||||
|
||||
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 mut tx = db.transaction().or(Err(MnmlHttpError::DbError))?;
|
||||
|
||||
match account::create(¶ms.name, ¶ms.password, ¶ms.code, &mut tx) {
|
||||
match account::create(¶ms.name, ¶ms.password, &mut tx) {
|
||||
Ok(token) => {
|
||||
tx.commit().or(Err(MnmlHttpError::ServerError))?;
|
||||
Ok(token_res(token))
|
||||
|
||||
Reference in New Issue
Block a user