mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-12 10:02:49 +00:00
server - support for admin/mod users
This commit is contained in:
@@ -7,6 +7,19 @@ defmodule MyAppWeb.UserController do
|
||||
|
||||
# https://us.battle.net/oauth/authorize?redirect_uri=https://localhost/api/battlenet/authorize&scope=wow.profile&client_id=vxqv32fddxsy6cmk6259amtymbuzmfrq&response_type=code
|
||||
|
||||
# this is for auth with username/password - currently only for admin
|
||||
def login(conn, params) do
|
||||
{output, status} = params
|
||||
|> Data.User.login
|
||||
|> Auth.Token.add_token_and_map_claims
|
||||
|> Response.put_resp
|
||||
|
||||
conn
|
||||
|> put_status(status)
|
||||
|> Response.json(output)
|
||||
end
|
||||
|
||||
# this is for authorization with battlenet
|
||||
@spec authorize(map, map) :: any
|
||||
def authorize(conn, %{"code" => code}) when not is_nil(code) do
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ defmodule MyAppWeb.Router do
|
||||
|
||||
scope "/user" do
|
||||
post "/authorize", UserController, :authorize
|
||||
post "/login", UserController, :login
|
||||
|
||||
pipe_through [:user_auth]
|
||||
get "/characters", UserController, :characters
|
||||
|
||||
Reference in New Issue
Block a user