Nach Aufräumen von Paket session kann dieses nur zu server umbenannt werden
This commit is contained in:
parent
c1fa004384
commit
c607b837b9
12
main.go
12
main.go
@ -17,7 +17,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"streifling.com/jason/sicherheitsunterweisung/packages/data"
|
"streifling.com/jason/sicherheitsunterweisung/packages/data"
|
||||||
"streifling.com/jason/sicherheitsunterweisung/packages/session"
|
"streifling.com/jason/sicherheitsunterweisung/packages/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -26,16 +26,16 @@ func main() {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mux := session.NewMux()
|
mux := server.NewMux()
|
||||||
sessions := make([]*session.Session, 0)
|
sessions := make([]*server.Session, 0)
|
||||||
sessionChan := make(chan *session.Session)
|
sessionChan := make(chan *server.Session)
|
||||||
|
|
||||||
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
|
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
|
||||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
template.Must(template.ParseFiles("templates/index.html", "templates/login.html")).Execute(w, nil)
|
template.Must(template.ParseFiles("templates/index.html", "templates/login.html")).Execute(w, nil)
|
||||||
})
|
})
|
||||||
mux.HandleFunc("/internal-login/", session.HandleInternalLogin(db, &sessions, sessionChan))
|
mux.HandleFunc("/internal-login/", server.HandleInternalLogin(db, &sessions, sessionChan))
|
||||||
mux.HandleFunc("/external-login/", session.HandleExternalLogin(&sessions))
|
mux.HandleFunc("/external-login/", server.HandleExternalLogin(&sessions))
|
||||||
|
|
||||||
go mux.HandleSessions(db, sessionChan, &sessions)
|
go mux.HandleSessions(db, sessionChan, &sessions)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -9,7 +9,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package session
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
Loading…
x
Reference in New Issue
Block a user