Show "registration not available" notice + validation error
authorChristian Weiske <cweiske@cweiske.de>
Sat, 2 Jan 2021 15:04:25 +0000 (16:04 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 2 Jan 2021 15:04:25 +0000 (16:04 +0100)
www/.htaccess
www/agreements/marketplace.html [new file with mode: 0644]
www/api/v1/gamers/register-error.json [new file with mode: 0644]

index a05e953d5bd4a315e91dca1f068ff78757987ccd..cf607a188bdd70924712c7a7deb3fb2bafc5b863 100644 (file)
@@ -19,6 +19,14 @@ RewriteRule ^api/v1/developers/(.+)/products/ /api/v1/developers/$1/products/%1.
 RewriteRule ^api/v1/discover/?$ /api/v1/discover-data/discover.json [END]
 RewriteRule ^api/v1/discover/(.+)$ /api/v1/discover-data/$1.json [END]
 
+#if directoryslash is on, gamers gets redirected to gamers/ (dir index)
+<Files "/api/v1/gamers">
+    DirectorySlash off
+</Files>
+#TODO: Use that only for the api/v1/gamers path, not for all
+ErrorDocument 400 /api/v1/gamers/register-error.json
+RewriteRule ^api/v1/gamers$ /api/v1/gamers/register-error.json [R=400,END]
+
 #purchased games/products
 # active buy requests
 RewriteCond %{REQUEST_METHOD} POST
diff --git a/www/agreements/marketplace.html b/www/agreements/marketplace.html
new file mode 100644 (file)
index 0000000..93b9ef7
--- /dev/null
@@ -0,0 +1,16 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>stouyapi marketplace agreements</title>
+ </head>
+ <body>
+  <h1>stouyapi - OUYA API server</h1>
+  <p>
+   We store no data, so you do not need to agree to anything :)
+  </p>
+  <p>
+   Registration of new accounts does not work here!
+   Simply go back and choose "existing account",
+   type any username, leave the password empty and sign in.
+  </p>
+ </body>
+</html>
diff --git a/www/api/v1/gamers/register-error.json b/www/api/v1/gamers/register-error.json
new file mode 100644 (file)
index 0000000..de9ef05
--- /dev/null
@@ -0,0 +1,11 @@
+{
+    "error": {
+        "message": "Validation errors occurred",
+        "code": 2006,
+        "data": {
+            "username": [
+                "Registration not available. Login instead."
+            ]
+        }
+    }
+}