Skip to content

Instantly share code, notes, and snippets.

View Angeloem's full-sized avatar
🎯
Focusing

Sanga Manuel Angeloem

🎯
Focusing
  • Tanzania
View GitHub Profile
class UserLogin(APIView):
permission_classes = [AllowAny]
authentication_classes = []
user = None
def call_login(self):
@Angeloem
Angeloem / rest_framework.py
Created August 6, 2022 11:29
rest framework settings
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'budgeter_api.shared.auth.JWTAuthentication',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
),
@Angeloem
Angeloem / auth.py
Created August 6, 2022 11:28
JWT Authentication
import datetime
import jwt
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import authentication, exceptions
from user.models import User
@Angeloem
Angeloem / auth.py
Created August 6, 2022 11:25
TokenAuthentication class, this is used to verify the token
import json
from django.contrib.auth.models import User
from rest_framework.authentication import BaseAuthentication
from pamoja_admin.shared.auth.enc_dec import decrypt
class TokenAuthentication(BaseAuthentication):
def authenticate(self, request):
@Angeloem
Angeloem / phonenumber_provider.py
Created January 22, 2022 08:48
getting the phone number provider in Tanzania. Feel free to modify
_carriers = {
'Tigo Tanzania': ['071', '065', '067'],
'Airtel Tanzania': ['078', '068', '069'],
'Vodacom Tanzania': ['075', '076', '074'],
'TTCL': ['073'],
'Halotel': ['061', '062'],
'Zantel': ['077'],
}
import 'package:flutter/material.dart';
import 'image.dart';
class ImageCarousel extends StatefulWidget {
final List images;
const ImageCarousel({Key? key, required this.images}) : super(key: key);
@override
@Angeloem
Angeloem / next_nginx.md
Created July 7, 2021 12:53 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw