1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Implement authentication

This commit is contained in:
Arne Schlüter 2018-04-18 01:30:25 +02:00
commit d782b49b94
7 changed files with 70 additions and 8 deletions

View file

@ -1,8 +1,28 @@
(ns airsonic-ui.views
(:require [re-frame.core :as re-frame]
[airsonic-ui.subs :as subs]
))
[airsonic-ui.config :as config]
[airsonic-ui.subs :as subs]))
(defn login-form []
[:form {:method "get"
:action config/server
:on-click #(js/alert "bang bang! TODO: implement login via form")}
[:div
[:span "User"]
[:input {:type "text" :name "user"}]]
[:div
[:span "Password"]
[:input {:type "password" :name "pass"}]]
[:div
[:input {:type "submit" :value "submit"}]]])
(defn app [user]
[:div
[:h2 (str "Currently logged in as " user)]])
(defn main-panel []
(let [name (re-frame/subscribe [::subs/name])]
[:div "Hello from " @name]))
[:div
[:h1 "Airsonic"]
(if-let [login @(re-frame/subscribe [::subs/login])]
[app (:u login)]
[login-form])])