- formating

This commit is contained in:
Alex Ling 2020-02-16 16:53:20 +00:00
parent 7c66b05872
commit 713694fd85
4 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,4 @@
require "yaml"
require "uuid"
require "base64"
class Config
include YAML::Serializable

View File

@ -3,7 +3,7 @@ require "./config"
require "./library"
require "./storage"
require "./auth_handler"
require "./static"
require "./static_handler"
require "./util"
class Server
@ -53,9 +53,9 @@ class Server
get "/admin/user/edit" do |env|
username = env.params.query["username"]?
admin = env.params.query["admin"]?
if admin
admin = admin == "true"
admin = env.params.query["admin"]?
if admin
admin = admin == "true"
end
error = env.params.query["error"]?
current_user = get_username env

View File

@ -10,7 +10,7 @@ end
macro get_username(env)
# if the request gets here, its has gone through the auth handler, and
# we can be sure that a valid token exists, so we can use not_nil! here
# we can be sure that a valid token exists, so we can use not_nil! here
cookie = {{env}}.request.cookies.find { |c| c.name == "token" }.not_nil!
(storage.verify_token cookie.value).not_nil!
end