Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component {
  2.    
  3.     this.name = "AdminApp";
  4.     this.applicationtimeout = createTimeSpan(1,0,0,0);
  5.     this.sessionmanagement = true;
  6.     this.sessiontimeout = createTimeSpan(0,8,0,0);
  7.     this.clientstorage = "cookie";
  8.     this.clientmanagement = true;
  9.     this.datasource = "admindsn";
  10.     this.loginstorage = "session";
  11.     this.serverSideFormValidation = "yes";
  12.     this.setclientcookies = "yes";
  13.     this.setdomaincookies = "yes";
  14.     this.scriptprotect = "yes";
  15.     this.smtpserversettings = {server="mail.example.de",username="info@example.de",password="123456"};
  16.     this.timeout = "90";
  17.     this.debuggingipaddress = "127.0.0.1";
  18.     this.enablerobustexception  = "yes";
  19.     //this.customtagpaths =expandpath('custom/tags/');
  20.  
  21.  
  22.     ormlocation="orm";
  23.     // orm settings
  24.     this.ormEnabled = true;
  25.     this.ormsettings = {
  26.         autoGenMap=true,
  27.         cfclocation=ormlocation,
  28.         datasource="admindsn",
  29.         dbcreate="update",
  30.         dialect="MySQLwithInnoDB"
  31.            
  32.  
  33.     };
  34.  
  35.     public boolean function onApplicationStart(){
  36.     // Solr Collections aktualisieren
  37.     application.Solr=createobject("component","custom.cfc.solr");
  38.     application.Solr.init();
  39.    
  40.    //Wann wurde die App gestartet
  41.     application.started=now();
  42.    
  43.     //Oft verwendete Funktionen im App Scope parken (keine ORM CFCs)
  44.    
  45.     // Sicherheitsfunktionen für Hashes, SSH Connections etc.
  46.     application.secure=createobject("component","custom.cfc.secure");
  47.    
  48.     //Funktionen um Tags in cfscript verfügbar zu machen (<cfabort> etc.)
  49.     application.scripts=createobject("component","custom.cfc.missingscripts");
  50.  
  51.     return true;
  52.     }
  53.  
  54.  
  55.     public boolean function onRequestStart(){
  56.     //Sprache für Formatierungfunktionen (LSDateFormat etc.)
  57.     SetLocale ("German (Standard)");
  58.    
  59.     //URl und FORM Variablen in gemeinsamen RequestScope packen
  60.     structAppend(request, url, false);
  61.    structAppend(request, form, true);
  62.    
  63.       //App über URL Parameter neu starten
  64.      
  65.     if(structkeyexists(request,"reboot")){
  66.    structclear(session);
  67.         structclear(variables);
  68.         structclear(request);
  69.         applicationStop();
  70.         ormreload();
  71.         location(cgi.SCRIPT_NAME,false);
  72.     }
  73.     //Softkill , ohne Sessions zu zerstören
  74.     if(structkeyexists(request,"softkill")){
  75.    applicationStop();
  76.     }
  77.    
  78.     //Logout
  79.     if(structkeyexists(request,"logout")){
  80.     structdelete(session,"login");
  81.     location(cgi.SCRIPT_NAME,false);
  82.     }
  83.    
  84.     //Sind wir schon angemeldet?
  85.     if(not structkeyexists(session,"login")){
  86.    
  87.     if(cgi.REQUEST_METHOD is "POST" and structkeyexists(request,"doLogin")){
  88.     //Passwort vor der Abfrage verschlüsseln
  89.     loginreq=EntityLoad('user', {loginname=#request.user#, password=#application.secure.gethash(request.password)#,role='Admin'}, true);
  90.    
  91.     //Haben wir ein Ergebnis, dann einloggen und Anmeldung protokollieren
  92.     if (isdefined("loginreq")){
  93.     session.login.fullname=loginreq.getfullname();
  94.     session.login.loginname=loginreq.getloginname();
  95.     session.login.password=loginreq.getpassword();
  96.     session.login.role=loginreq.getrole();
  97.     writelog(text=session.login.loginname&" eingeloggt von "&cgi.REMOTE_ADDR,application="yes",file="adminapp");
  98.     location(cgi.SCRIPT_NAME,false);
  99.     }
  100.     else{
  101.    
  102.     //Kein Ergebnis? Also Fehler ausgeben und protokollieren
  103.     request.login_error="Login Fehlgeschlagen!";
  104.     writelog(text="Fehlgeschlagener Login von "&cgi.REMOTE_ADDR,type="error",application="yes",file="isptool");
  105.  
  106.     }
  107. }
  108.     //Nicht angemeldet, also Login Seite anzeigen
  109.     include "login.cfm";
  110.     application.scripts.abort();
  111.     }
  112.         return true;
  113.     }
  114.  
  115.  
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement