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 android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.ColorFilter; | |
import android.graphics.CornerPathEffect; | |
import android.graphics.Paint; | |
import android.graphics.Path; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; |
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
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="@dimen/info_window_width" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/cta_action_text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:gravity="center" |
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.base_user import BaseUserManager | |
from django.db import models | |
from django.contrib.auth.models import AbstractUser | |
from django.utils.translation import ugettext_lazy as _ | |
class CustomUserManager(BaseUserManager): | |
""" | |
Custom user model manager where email is the unique identifiers | |
for authentication instead of usernames. |
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 import get_user_model | |
from django.contrib.auth.backends import ModelBackend | |
class EmailBackend(ModelBackend): | |
def authenticate(self, request, **kwargs): | |
UserModel = get_user_model() | |
try: | |
email = kwargs.get('email', None) | |
if email is None: |
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 import get_user_model | |
from rest_framework import serializers | |
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer as JwtTokenObtainPairSerializer | |
class TokenObtainPairSerializer(JwtTokenObtainPairSerializer): | |
username_field = get_user_model().USERNAME_FIELD | |
class UserSerializer(serializers.ModelSerializer): |
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 import get_user_model | |
from rest_framework.response import Response | |
from rest_framework.status import HTTP_201_CREATED, HTTP_400_BAD_REQUEST | |
from rest_framework.views import APIView | |
from rest_framework_simplejwt.views import TokenObtainPairView | |
from ..serializers.user import UserSerializer, TokenObtainPairSerializer | |
class RegisterView(APIView): |
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.urls import path | |
from rest_framework_simplejwt.views import TokenRefreshView | |
from .views import EmailTokenObtainPairView, RegisterView | |
urlpatterns = [ | |
path('register/', RegisterView.as_view(), name='token_obtain_pair'), | |
path('token/obtain/', EmailTokenObtainPairView.as_view(), name='token_obtain_pair'), | |
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), | |
] |
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 django.contrib.auth.admin import UserAdmin | |
from django.utils.translation import gettext_lazy as _ | |
from .models import EmailUser | |
class EmailUserAdmin(UserAdmin): | |
fieldsets = ( | |
(None, {'fields': ('email', '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
const timer = ms => new Promise(res => setTimeout(res, ms)) | |
const delayMs = 4000; | |
const repeat = 30; | |
async function deleteRecord () { | |
for (var i = 0; i < repeat; i++) { | |
document.querySelector('.pointer.cl-non-selectable.cl-component-divided-left.cl-d-flex.cl-dropdown-toggle.cl-no-arrow').click() | |
document.querySelector('a[data-cy="delete-button"]').click() | |
document.querySelector('button[class="cl-btn cl-btn-danger"]').click() | |
await timer(delayMs); |