This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.contrib.auth.models import User | |
from django import forms | |
def my_portal_authenticate(username, password): | |
if username == 'fooDjango' | |
and password == 'barDjango': | |
return True | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class DateModel(models.Model): | |
created_by = models.CharField(max_length=50) | |
modified_by = models.CharField(max_length=50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from app.models import MyModel | |
admin.site.register(MyModel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.forms import AuthenticationForm | |
from django.forms import ValidationError | |
class CustomLoginForm(AuthenticationForm): | |
#overriding clean method to change default authentication behaviour | |
def clean(self): | |
userid = self.cleaned_data.get('username') | |
password = self.cleaned_data.get('password') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.admin import AdminSite | |
from .login import CustomLoginForm | |
from django.utils.translation import ugettext_lazy as _ | |
from .models import MyModel | |
Class CustomLoginAdminSite(AdminSite): | |
site_title = _('My site admin') | |
site_header = _('Administration') | |
index_title = _('CustomLogin') | |
#registering Custom login form for the Login interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from app.admin import admin_site | |
urlpatterns = [ | |
url(r'^app/',include('app.urls',namespace="app"),name='app_access'), | |
#informing the django about the new admin site | |
# TADA thats done !! whhoh | |
url(r'^admin/', include(admin_site.urls)), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Rest of Settings.py | |
AUTHENTICATION_BACKENDS = [ | |
'django.contrib.auth.backends.ModelBackend', | |
'app.backends.MyPortalBackend', | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import splunklib.client as client | |
from splunklib.binding import AuthenticationError | |
import sys | |
import json | |
splunk_config = { | |
"splunk":{ | |
"host": "localhost", | |
"port": 8089, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import splunklib.client as client | |
from splunklib.binding import AuthenticationError | |
import sys | |
import json | |
splunk_config = { | |
"splunk":{ | |
"host": "localhost", | |
"port": 8089, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Understand how the fucntion call look like in assembly. | |
gcc -m32 function_call.c -o fucntion_call -fno-stack-protector | |
*/ | |
#include <stdio.h> | |
#include <unistd.h> | |
void foo(){ | |
printf("Printing from foo"); |
OlderNewer