Browse Source

fixed error messages

master
Robin Thoni 9 years ago
parent
commit
3948cfb34a
2 changed files with 4 additions and 4 deletions
  1. 2
    2
      status.php
  2. 2
    2
      user.php

+ 2
- 2
status.php View File

@@ -8,7 +8,7 @@ function check_token()
8 8
   $date = new DateTime($token["date"]);
9 9
   $date->add(new DateInterval("P1D"));
10 10
   if ($token === false || $date < new DateTime())
11
-    error(401, "Invalid token");
11
+    error(401, "Invalid user token");
12 12
   return $token["token"];
13 13
 }
14 14
 
@@ -48,7 +48,7 @@ function status_create()
48 48
   $token = check_token();
49 49
   $status = get_post("status");
50 50
   if (strlen($status) < 10)
51
-    error(422, "Status too short");
51
+    error(422, "Status length too short");
52 52
 
53 53
   $lat = check_float(get_post("latitude", false));
54 54
   $long = check_float(get_post("longitude", false));

+ 2
- 2
user.php View File

@@ -15,7 +15,7 @@ function user_create()
15 15
     error(422, "Username too short");
16 16
   if (database_exec("SELECT id FROM users WHERE `username` = :username",
17 17
     array(":username" => $username))->fetch() !== false)
18
-    error(409, "Username already exists");
18
+    error(409, "Username already taken");
19 19
   database_exec("INSERT INTO users (`username`, `password`) ".
20 20
     "VALUES(:username, :password)", array(":username" => $username,
21 21
       ":password" => hash_password($password)));
@@ -37,7 +37,7 @@ function user_login($username = false)
37 37
     $args = array(":username" => $username);
38 38
   $u = database_exec($query, $args)->fetch();
39 39
   if ($u === false)
40
-    error(401, "Wrong username or password");
40
+    error(401, "Bad credentials");
41 41
   $token = hash_password(uniqid(mt_rand(), true));
42 42
   database_exec("INSERT INTO tokens (`token`, `user`) VALUES (:token, :user)",
43 43
     array(":token" => $token, ":user" => $u['id']));

Loading…
Cancel
Save