Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component {
- this.name = "AdminApp";
- this.applicationtimeout = createTimeSpan(1,0,0,0);
- this.sessionmanagement = true;
- this.sessiontimeout = createTimeSpan(0,8,0,0);
- this.clientstorage = "cookie";
- this.clientmanagement = true;
- this.datasource = "admindsn";
- this.loginstorage = "session";
- this.serverSideFormValidation = "yes";
- this.setclientcookies = "yes";
- this.setdomaincookies = "yes";
- this.scriptprotect = "yes";
- this.smtpserversettings = {server="mail.example.de",username="info@example.de",password="123456"};
- this.timeout = "90";
- this.debuggingipaddress = "127.0.0.1";
- this.enablerobustexception = "yes";
- //this.customtagpaths =expandpath('custom/tags/');
- ormlocation="orm";
- // orm settings
- this.ormEnabled = true;
- this.ormsettings = {
- autoGenMap=true,
- cfclocation=ormlocation,
- datasource="admindsn",
- dbcreate="update",
- dialect="MySQLwithInnoDB"
- };
- public boolean function onApplicationStart(){
- // Solr Collections aktualisieren
- application.Solr=createobject("component","custom.cfc.solr");
- application.Solr.init();
- //Wann wurde die App gestartet
- application.started=now();
- //Oft verwendete Funktionen im App Scope parken (keine ORM CFCs)
- // Sicherheitsfunktionen für Hashes, SSH Connections etc.
- application.secure=createobject("component","custom.cfc.secure");
- //Funktionen um Tags in cfscript verfügbar zu machen (<cfabort> etc.)
- application.scripts=createobject("component","custom.cfc.missingscripts");
- return true;
- }
- public boolean function onRequestStart(){
- //Sprache für Formatierungfunktionen (LSDateFormat etc.)
- SetLocale ("German (Standard)");
- //URl und FORM Variablen in gemeinsamen RequestScope packen
- structAppend(request, url, false);
- structAppend(request, form, true);
- //App über URL Parameter neu starten
- if(structkeyexists(request,"reboot")){
- structclear(session);
- structclear(variables);
- structclear(request);
- applicationStop();
- ormreload();
- location(cgi.SCRIPT_NAME,false);
- }
- //Softkill , ohne Sessions zu zerstören
- if(structkeyexists(request,"softkill")){
- applicationStop();
- }
- //Logout
- if(structkeyexists(request,"logout")){
- structdelete(session,"login");
- location(cgi.SCRIPT_NAME,false);
- }
- //Sind wir schon angemeldet?
- if(not structkeyexists(session,"login")){
- if(cgi.REQUEST_METHOD is "POST" and structkeyexists(request,"doLogin")){
- //Passwort vor der Abfrage verschlüsseln
- loginreq=EntityLoad('user', {loginname=#request.user#, password=#application.secure.gethash(request.password)#,role='Admin'}, true);
- //Haben wir ein Ergebnis, dann einloggen und Anmeldung protokollieren
- if (isdefined("loginreq")){
- session.login.fullname=loginreq.getfullname();
- session.login.loginname=loginreq.getloginname();
- session.login.password=loginreq.getpassword();
- session.login.role=loginreq.getrole();
- writelog(text=session.login.loginname&" eingeloggt von "&cgi.REMOTE_ADDR,application="yes",file="adminapp");
- location(cgi.SCRIPT_NAME,false);
- }
- else{
- //Kein Ergebnis? Also Fehler ausgeben und protokollieren
- request.login_error="Login Fehlgeschlagen!";
- writelog(text="Fehlgeschlagener Login von "&cgi.REMOTE_ADDR,type="error",application="yes",file="isptool");
- }
- }
- //Nicht angemeldet, also Login Seite anzeigen
- include "login.cfm";
- application.scripts.abort();
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement