mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
- formating
This commit is contained in:
parent
7c66b05872
commit
713694fd85
@ -1,6 +1,4 @@
|
|||||||
require "yaml"
|
require "yaml"
|
||||||
require "uuid"
|
|
||||||
require "base64"
|
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
include YAML::Serializable
|
include YAML::Serializable
|
||||||
|
@ -3,7 +3,7 @@ require "./config"
|
|||||||
require "./library"
|
require "./library"
|
||||||
require "./storage"
|
require "./storage"
|
||||||
require "./auth_handler"
|
require "./auth_handler"
|
||||||
require "./static"
|
require "./static_handler"
|
||||||
require "./util"
|
require "./util"
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
@ -53,9 +53,9 @@ class Server
|
|||||||
|
|
||||||
get "/admin/user/edit" do |env|
|
get "/admin/user/edit" do |env|
|
||||||
username = env.params.query["username"]?
|
username = env.params.query["username"]?
|
||||||
admin = env.params.query["admin"]?
|
admin = env.params.query["admin"]?
|
||||||
if admin
|
if admin
|
||||||
admin = admin == "true"
|
admin = admin == "true"
|
||||||
end
|
end
|
||||||
error = env.params.query["error"]?
|
error = env.params.query["error"]?
|
||||||
current_user = get_username env
|
current_user = get_username env
|
||||||
|
@ -10,7 +10,7 @@ end
|
|||||||
|
|
||||||
macro get_username(env)
|
macro get_username(env)
|
||||||
# if the request gets here, its has gone through the auth handler, and
|
# 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!
|
cookie = {{env}}.request.cookies.find { |c| c.name == "token" }.not_nil!
|
||||||
(storage.verify_token cookie.value).not_nil!
|
(storage.verify_token cookie.value).not_nil!
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user