teleren/devto huggingface dataset:
unable to authenticate using django form

Tags: django
Published: 2021-06-11 12:45:50

from django.shortcuts import render

from django.contrib.auth.models import User

from django.shortcuts import redirect

from django.contrib.auth.forms import UserCreationForm

from django.contrib.auth import authenticate, login

from .forms import LoginForm

def Register(request):

if request.method == 'POST':

    form = UserCreationForm(request.POST)

    if form.is_valid():

        data = form.cleaned_data

        user = User.objects.create(username=data['username'],

                                   #    password=data['password1']

                                   )

        user.set_password(data['password1'])

        user.save()

        return redirect('/')

form = UserCreationForm()

context = {

    'form': form

}

return render(request, 'register.html', context)

def LoginUser(request):

if request.method == 'POST':

    form = LoginForm(request.POST)

    if form.is_valid():

        

        data = form.cleaned_data

        user = authenticate(

            request, username=data['username'], password=data['passsword'])

        print(data)

        print(user)

form = LoginForm()

context = {

    'form': form

}

return render(request, 'login.html', context)
forms.py

from django import forms

class LoginForm(forms.Form):

username = forms.CharField(max_length=100,)

passsword = forms.CharField(widget=forms.PasswordInput)
output

Starting development server at http://127.0.0.1:8000/

Quit the server with CTRL-BREAK.

{‘username’: ‘abc’, ‘passsword’: ‘abc’}

None

[11/Jun/2021 17:00:47] “POST /login HTTP/1.1” 200 3330

{‘username’: ‘abc’, ‘passsword’: ‘abc’}

None

[11/Jun/2021 17:01:05] “POST /login HTTP/1.1” 200 3330
The SRE Newsletter Issue 31
Tags: sre, devops
Published: 2021-06-11 12:44:23

In this week's issue of the SRE Newsletter, we take a look at:
- Senior Engineer Skills Beyond Coding
- Building a Healthy On-Call Culture
- What is Resilience Engineering?
- and more!

[https://www.srenewsletter.com/issues/031/](https://www.srenewsletter.com/issues/031/?utm_source=devto)
unable to authenticate using django form

Published: 2021-06-11 12:43:12


views.py

    from django.shortcuts import render
    from django.contrib.auth.models import User
    from django.shortcuts import redirect
    from django.contrib.auth.forms import UserCreationForm
    from django.contrib.auth import authenticate, login
    from .forms import LoginForm

    def Register(request):
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            user = User.objects.create(username=data['username'],
                                       #    password=data['password1']
                                       )
            user.set_password(data['password1'])
            user.save()
            return redirect('/')

    form = UserCreationForm()

    context = {
        'form': form
    }
    return render(request, 'register.html', context)


    def LoginUser(request):
    if request.method == 'POST':
        form = LoginForm(request.POST)
        if form.is_valid():

            

            data = form.cleaned_data
            user = authenticate(
                request, username=data['username'], password=data['passsword'])
            print(data)
            print(user)

    form = LoginForm()
    context = {
        'form': form
    }
    return render(request, 'login.html', context)

forms.py 


    from django import forms

    class LoginForm(forms.Form):
    username = forms.CharField(max_length=100,)
    passsword = forms.CharField(widget=forms.PasswordInput)


output

Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
{'username': 'abc', 'passsword': 'abc'}
None
[11/Jun/2021 17:00:47] "POST /login HTTP/1.1" 200 3330
{'username': 'abc', 'passsword': 'abc'}
None
[11/Jun/2021 17:01:05] "POST /login HTTP/1.1" 200 3330
Pattern Matching in Elixir
Tags: elixir
Published: 2021-06-11 12:22:07

*reposted from https://reergymerej.github.io/blog/2021/06/11/pattern-matching.html*

When discussing pattern matching in Elixir (and other languages), it seems like most of what people talk about isn't the actual _matching_ part.


## Pattern Matching

**Pattern matching** is the ability to check if the left and right match.

```elixir
iex(1)> 1 = 1
1

iex(2)> 2 = 1
** (MatchError) no match of right hand side value: 1
```

It is sensitive to **data types**.

```elixir
iex(1)> [] = []
[]

iex(2)> [] = {}
** (MatchError) no match of right hand side value: {}
```

It checks the **shape** of the data as well.

```elixir
iex(1)> {1} = {1}
{1}

iex(2)> {} = {1}
** (MatchError) no match of right hand side value: {1}
```


It can be used to **branch** code.

```elixir
case 1 do
  1 -> "one"
  2 -> "two"
end
"one"
```

That's really all there is to it.  Everything else is _using_ pattern matching.

## Using Pattern Matching

When matching, you can **bind** values on the LHS.

```elixir
iex(1)> foo = 1
1

iex(2)> foo
1
```


This works in `case`s too.

```elixir
case 1 do
  foo -> foo
end
1
```

You can **destructure** values while binding.

```elixir
iex(1)> [foo, 2] = [1, 2]
[1, 2]

iex(2)> foo
1
```

You can **ignore** parts of the data.

```elixir
iex(1)> [foo] = [1, 2]
** (MatchError) no match of right hand side value: [1, 2]

iex(1)> [foo, _] = [1, 2]
[1, 2]
```

You can use underscore as a **wildcard** when branching.

```elixir
case "bitch" do
  "cops" -> "yep"
  "critics" -> "yep"
  "paparazzi" -> "yep"
  _ -> "ain't one"
end
"ain't one"
```

And finally, the ever-popular **splitting** of head/tail of a list.

```elixir
iex(1)> [head | tail] = [1, 2, 3]
[1, 2, 3]

iex(2)> head
1

iex(3)> tail
[2, 3]
```
Go Programming - Hexagonal Architecture
Tags: go
Published: 2021-06-11 12:12:59

###Agenda
* Ports and Adaptros
* jmoiron/sqlx
* go-sql-driver/mysql 
* gorilla/mux
* spf13/viper

####ติดตามผลงานได้ที่
* **Page:** [https://fb.com/CodeBangkok​](https://fb.com/CodeBangkok​)
* **Group:** [https://fb.com/groups/msdevth​](https://fb.com/groups/msdevth​)
* **Blog:** [https://dev.to/codebangkok](https://dev.to/codebangkok)
* **YouTube:** [https://youtube.com/CodeBangkok](https://youtube.com/CodeBangkok)
Siblings Software
Published: 2021-06-11 12:07:37

Top-notch technology lovers, at Siblings Software we simplify companies’ and users' lives through our high-quality, innovative software solutions and staff augmentation services. Headquartered in Miami, our team has solid experience developing in Django, Node, Angular, React, React Native, Gatsby, .NET and Rails frameworks as well as in Python, JavaScript, C#, Java, PHP and Ruby programming languages.
Day 23/30 : Button with Animated Border using HTML and CSS
Tags: html, css, webdev, tutorial
Published: 2021-06-11 12:02:55

Welcome to Day 23 of this [Challenge](https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1). This is what I created today. 

**➜ Here is the Demo :**
![Button with Animated Border using HTML and CSS](https://1.bp.blogspot.com/-xdnwO5mandY/YKoXF6uHv0I/AAAAAAAAAHQ/ODXjlVVBofEUXHWk1aUhZ-tQDaPGSN4qgCLcBGAsYHQ/s600/p23.gif)

**➜ Video Tutorial :**

{% youtube 1--XN4gLL8M %}
**➜ Source Code :**
https://www.futurecodersweb.com/2021/06/button-with-animated-border-using-html.html


**➜ Instagram Post and Reel for Day 23 :**
[See Post and Reel](https://www.instagram.com/future_coderss/)

------------------------------------------------------------------

Hey, If You don't know what is happening here. Don't Worry, I am doing a crazy challenge 😅. Read More about it from the post below.

{% link https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1 %}

**Support Me :**
👉 Buy me a Coffee: https://www.buymeacoffee.com/somanathgoudar
👉 [Follow Me on Instagram](https://www.instagram.com/somanath_goudar/)
👉 [Follow Future Coders on Instagram](https://www.instagram.com/future_coderss/)
👉 [Subscribe to My Main Channel](https://www.youtube.com/channel/UC_nTrhTr5fnBGjOxnkPUmmA)
👉 [Subscribe to Channel Created for this Challenge](https://www.youtube.com/channel/UCzGSyMOf2jPt1MkNBB3SJ3g)

------------------------------------------------------------------
How can i create a dynamic menu
Tags: rails, menu, help
Published: 2021-06-11 12:00:21

Hello
I am trying to build a Blog CMS with ruby on rails 6. SO I have created Post, Pages and Categories with a back end admin panel.
Now i want to add a menu from the back end. where i create a menu and in that menu there might be a page with link, post with link and category with link. each one of them is going to be a menu item so that i can view those item in the front end as a link.
Can any one please tell me, how can i do this?
Thank you
Django Enhance Password Policy
Tags: django, github, template, tutorial
Published: 2021-06-11 11:38:10

#Preface
Django build in password policy are by itself provide a great basis toward making sure the password that the user choose is relatively strong enough that its hard to guess. 

Build in [Password Validators](https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#enabling-password-validation)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3v4sxde4jv6osdk22iw9.png)

however usually in a business setting, almost all company will have its own set of password policy that need fine grain control of what is acceptable and what is not.

Things like password require 1 uppercase, 1 lowercase, 1 digit, and 1 special character or thing such as no repeated password for the last x number password change require a special kinda of password validator so that we can make it better. My go to password validator would be [django-password-validators](https://github.com/fizista/django-password-validators).

## Installing Django Password Validator

Installing django-password-validators with the command:
```
pipenv install django-password-validators
pipenv lock -r >requirements.txt
```

## Configuring the settings

If you want to have only the password strength check, just use the  following in your settings.py file

```python
 INSTALLED_APPS = [
     ...
     'django_password_validators',
     ...
 ]

AUTH_PASSWORD_VALIDATORS = [
    ...
    {
        'NAME': 'django_password_validators.password_character_requirements.password_validation.PasswordCharacterValidator',
        'OPTIONS': {
             'min_length_digit': 1,
             'min_length_alpha': 2,
             'min_length_special': 3,
             'min_length_lower': 4,
             'min_length_upper': 5,
             'special_characters': "~!@#$%^&*()_+{}\":;'[]"
         }
    },
    ...
]
```

however if you need validator to check with the historical password 

```python
 INSTALLED_APPS = [
     ...
     'django_password_validators',
     'django_password_validators.password_history',
     ...
 ]

AUTH_PASSWORD_VALIDATORS = [
    ...
    {
        'NAME': 'django_password_validators.password_history.password_validation.UniquePasswordsValidator',
        'OPTIONS': {
             # How many recently entered passwords matter.
             # Passwords out of range are deleted.
             # Default: 0 - All passwords entered by the user. All password hashes are stored.
            'last_passwords': 5 # Only the last 5 passwords entered by the user
        }
    },
    ...
]

# If you want, you can change the default hasher for the password history.
DPV_DEFAULT_HISTORY_HASHER = 'django_password_validators.password_history.hashers.HistoryHasher'
```

##End

I think with django-password-validators package, we are now able to make sure that the user would atleast have a much harder password to crack.
3 ways to send emails with only few lines of code and Gmail - Series
Tags: javascript, ruby, python, smtp
Published: 2021-06-11 11:56:07

*We will see how to send a simple email with the help of three different programming languages: Javascript, Ruby and Python
Before you start you need to create a Gmail account.
Do not forget to accept and allow the "Less secure apps" access in order use your scripts with your Gmail smtp connection.
I'll let you do this on your own, you don't need a tutorial for this* 😜  

Table of teasing
-

- [Javascript 🚀 - Part 1](https://dev.to/fralps/3-ways-to-send-emails-with-only-few-lines-of-code-and-gmail-javascript-part-1-4i92)
- [Ruby 💎 - Part 2](https://dev.to/fralps/3-ways-to-send-emails-with-only-few-lines-of-code-and-gmail-ruby-part-2-23nc)
- [Python 🐍 - Part 3](https://dev.to/fralps/3-ways-to-send-emails-with-only-few-lines-of-code-and-gmail-python-part-3-13e0)
MSG에서 Outlook PST 메시지를 여는 방법은 무엇입니까?
Published: 2021-06-11 11:41:22


PST 파일을 MSG 형식으로 열려면 사용자는이 PST to MSG 변환기 도구를 사용해야합니다. 이 변환기 도구는 전문적으로 설계된 앱입니다. 도구로 PST 파일을 효율적이고 쉽게 변환 할 수 있습니다. <b><a href="https://www.gaintools.com/pst/msg/">PST에서 MSG로 온라인 도구</a></b>

사용자가 PST 파일을 MSG 형식으로 안정적으로 변환하려면이 놀라운 사용자 친화적 인 PST to MSG 변환기 도구를 사용해야합니다. 응용 프로그램은 즉시 PST 파일의 변환을 수행합니다. PST 파일을 변환하는 동안 장애물에 직면 한 사용자는 없습니다. 그 외에도 앱이 놀라운 그래픽 사용자 인터페이스를 제공하므로 초보 사용자는 어떤 종류의 기술 지원도받지 않고도 PST 파일을 변환 할 수 있습니다. 앱은 중단없이 작업을 수행하고 사용자에게 원하는 결과를 제공합니다. 또한 사용자는 매번 원하는 결과를 얻습니다. 완전한 정확도로 모든 Outlook PST 파일은 MSG 형식으로 변환됩니다. 파일의 무결성은 전체 변환 작업 동안 그대로 유지됩니다. 그 외에도 사용자는 PST 파일을 MSG 형식으로 변환하는 동안 모든 종류의 데이터 손상에 직면하지 않으며 매번 건강한 결과를 얻습니다. 사용자는 몇 분 안에 100 % 정확한 결과를 얻으려면이 응용 프로그램을 사용해보아야합니다.

이 앱은 완전한 안전과 보안으로 즉시 결과를 제공합니다.

<b>PST 파일을 MSG 형식으로 변환하는 절차!</b>

다음은 Outlook PST 파일을 안정적이고 원활하게 변환하는 절차입니다.

1 단계 : Windows 운영 체제에 PST to MSG 변환기 앱 설치

2 단계 : 도구를 시작합니다.

3 단계 : 변환하려는 PST 파일 추가

4 단계-이제 선택한 모든 PST 파일을 미리 봅니다.

5 단계 : PST 파일을 변환 할 형식 선택

6 단계- "지금 변환"버튼을 클릭하여 단계를 완료합니다.

이러한 단계는 기술적 배경이 있든 없든 모든 사용자가 쉽게 수행 할 수 있습니다.

<b>PST 에 MSG 변환기 도구의 주요 기능</b>

다음은 사용자가 PST 파일을 MSG 형식으로 변환하는 데 도움이되는 도구의 주요 기능입니다.

• 좋은 정확도

이 놀라운 앱을 사용하면 모든 PST 파일이 정확하게 MSG 형식으로 변환됩니다. 이 놀라운 응용 프로그램은 데이터 손상이나 데이터 유출 파일을 변환하지 않습니다.

•	사용하기 쉬운

앱은 사용자 친화적 인 도구이므로 모든 사용자가이 응용 프로그램을 사용할 수 있습니다. 사용자에게 어떤 종류의 기술 지원도 필요하지 않습니다.

• 뛰어난 호환성

사용자는 Windows 운영 체제의 새 버전부터 이전 버전까지이 놀라운 응용 프로그램을 사용할 수 있습니다.

<b>최종 진술</b>

Outlook PST 파일을 MSG 형식으로 변환하려는 사용자를 위해이 놀라운 PST to MSG 변환기 도구를 사용해보십시오. 이 PST to MSG 변환기는 Outlook PST 파일을 변환하는 데 사용되는 최고의 플랫폼 중 하나입니다. 응용 프로그램에 대한 예리한 지식을 얻으려면 도구의 데모 버전을 사용해보아야합니다. 이 데모 버전은 무료이며 MSG 형식으로 변환 할 수있는 몇 가지 Outlook PST 파일을 제공합니다. 라이선스가 부여 된 앱 버전도 도구에서 제공합니다. 이 라이선스 버전은 사용자가 무제한 PST 파일을 MSG 형식으로 변환 할 수 있도록합니다. 앱의 평생 업데이트는 라이선스 버전에서도 제공됩니다. 사용자는 먼저 데모 버전을 사용해 본 다음 라이선스 버전의 앱을 구입해야합니다.

도구에 의해 문제가 발생하면 앱에서 해결할 수 있도록 풀 타임 고객 서비스도 도구에서 제공됩니다.
🤖 Dependable and Secure Realtime in Spring Boot with Auth0 and Ably
Tags: identity, ably, auth0, security
Published: 2021-06-11 11:35:22

#### 📕 Learn how to build a realtime chat application with Spring Boot, Auth0 and Ably.

When developing a service, one of the main hurdles to consider is authentication. For every action, you’ll need to both authorize the user (check they are who they say they are) and then ensure they can only do actions which they have permission to do.

Auth0, an authentication and authorization platform, simplifies this process immensely. Not only does it allow for easy integration with your own login systems, it makes integrating other login services such as Google and Twitter simple. It allows for a simple setup of permissions, roles with set permissions attached, and for these roles to be assigned to users. These users can then make use of various login systems to access the same account and thus have the same permissions associated with them.

With Spring Boot, this is extremely powerful, partially due to the strong integration of Auth0 with it. A simple redirect to an Auth0 login page will return a token which a Spring Boot server can use to verify the user and access their associated permissions.

This token can then be used to correctly generate access to other services. For example, [Ably](https://ably.com/), a real-time communications solution, makes use of tokens to authenticate with an Ably App. Once a user has authenticated with Auth0 and has an Auth0 token, they can use this to request a token from a Spring Boot server to authenticate directly with Ably, with the appropriate permissions and access granted.

In this tutorial, we’ll be going through the basics of setting up an interoperating system as described above. The actual service we’ll be providing is a chat application, which will:

* Allow users to sign in using a Google account
* Signed in users will be able to publish messages to a group chat
* Non-signed in users will be able to subscribe and read messages published
* Users will be able to see who is online in the chat
* Users will, when joining, be able to load the last 20 messages of conversation they’ve missed


[Read more...](https://auth0.com/blog/dependable-and-secure-realtime-in-spring-boot-with-auth0-and-ably/?utm_source=content_synd&utm_medium=sc&utm_campaign=auth0_ably)
ZK-Rollups: how the layer 2 solution works
Tags: ethereum, cryptocurrency, blockchain, crypto
Published: 2021-06-12 06:31:48

---
title: ZK-Rollups: how the layer 2 solution works
published: true
date: 2021-06-11 11:21:50 UTC
tags: ethereum,cryptocurrency,blockchain,crypto
canonical_url: https://medium.com/coinmonks/zk-rollups-how-the-layer-2-solution-works-8fd07c222329
---

[![](https://cdn-images-1.medium.com/max/2600/1*hubvFJrKUeg8jIosMlrtMQ.png)](https://medium.com/coinmonks/zk-rollups-how-the-layer-2-solution-works-8fd07c222329?source=rss----721b17443fd5---4)

In the previous article, we openly discussed how the first layer 2 solution proposed to scale the Ethereum Blockchain, namely Plasma…

[Continue reading on Coinmonks »](https://medium.com/coinmonks/zk-rollups-how-the-layer-2-solution-works-8fd07c222329?source=rss----721b17443fd5---4)
MLblog-Simple website
Tags: html, webdev, beginners
Published: 2021-06-11 10:16:20

Here's the website...
mlblog.rf.gd
Explore and have fun
![MLblog](https://raw.githubusercontent.com/Mischievous-Loner/MLblog/main/Screenshot_2021-06-11-13-58-43-986_mark.via.gp.png)
🧩 How to Create CRUD REST API with AWS Chalice
Tags: aws, api, chalice, python
Published: 2021-06-11 10:11:23

#### 📗 Learn how to build a book database API with AWS Chalice serverless technology.

**TL;DR:** In this article, you will learn how to build Serverless Python applications with AWS Chalice. You will build a book database REST API to store book entries and perform CRUD operations on the API. The code for this tutorial is available here, [AWS Chalice API sample](https://github.com/auth0-blog/aws-chalice-api-sample)

## Introduction

AWS Chalice is a serverless Python framework developed by Amazon. It shares so many similarities in syntax and semantics with Flask. Like other serverless technology, Chalice allows the developer to be able to concentrate on application development without having to deal with managing servers. It uses [AWS Lambda](https://docs.aws.amazon.com/lambda/index.html) and the [Amazon API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html).

You will use [Chalice](https://github.com/aws/chalice) to build a book database REST API. Your users will be able to store book entries and perform CRUD operations on the API. Entries will be stored in a [DynamoDB](https://aws.amazon.com/dynamodb/) database. It is a NoSQL database system offered by Amazon. It stores data in the form of tables, items, and attributes.

Finally, you will also see how to integrate [Auth0](https://auth0.com/) authentication to your AWS Chalice applications. Besides, you will use Auth0 for authorization. Authorization will allow you to distinguish the endpoints that can be accessed by the general public from the ones that the authenticated users of the application have access to.

## Prerequisites

1. Python 3.7 or later versions
2. pip
3. venv
4. AWS account
5. AWS CLI

Ensure you have Python and `pip` installed on your machine. You can download Python for your operating system from the [official Python website](https://www.python.org/). You may install `pip` by following [these instructions](https://pip.pypa.io/en/stable/installing/).

Venv is a package for creating isolated environments for individual projects on a machine. If you installed Python 3.7 or later versions, venv would come pre-installed with the Python package.

You need an AWS account. You may [sign up](https://portal.aws.amazon.com/billing/signup) for one.
Check the [AWS CLI v2 user guide](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) if you do not have AWS CLI installed on your machine.


[Read more...](https://auth0.com/blog/how-to-create-crud-rest-api-with-aws-chalice/?utm_source=facebookgroup&utm_medium=sc&utm_campaign=aws)
Estereotipos y brecha de género en posiciones STEM
Tags: womenintech, techtalks, gendergap
Published: 2021-06-11 10:02:19

Actualmente, a pesar de los esfuerzos de las empresas por captar talento femenino a través de distintos planes de diversidad e inclusión, es muy difícil hacerlo. 

Básicamente porque apenas hay mujeres en carreras STEM (ciencia, tecnología, ingeniería y matemáticas).

En la siguiente charla, Irene Zeller y yo tratamos de explicar esta brecha de género a través de la historia de las mujeres en la tecnología desde un punto de vista relacionado con los estereotipos que siempre se nos han asignado a las mujeres.


{% youtube J9MVRj7W3oM %}
Introducing Otlio, a Powerful Todo List 🚀
Tags: showdev, webdev, portfolio, javascript
Published: 2021-06-11 09:44:50

Hello World! 🙋‍♂️👋
I would like to introduce Otlio, a powerful Todo List 🚀, which also supports **drag and drop**🤩.

Website Link: https://otlio.netlify.app/

## Features
1. Support for Google and GitHub **OAuth** 🔥 Login
2. Support for **2FA (Two Factor Authentication)** 🔑
3. Support for **Drag and Drop** Feature ✊
3. Heavy focus on **security** 🔐
4. **Customer Support** 🙌
5. Available in **Dark Mode** 🌓

Otlio is also an open source project 👐, which is hosted on: https://github.com/stanleyowen/otlio

If you find this project useful, leave a 🌟 on [GitHub](https://github.com/stanleyowen/otlio) to keep a beginner motivated. 😊

Any comments will be appreciated and everyone is welcome to contribute to this project (＾Ｕ＾)ノ

## Happy Coding! 🎉

You may also like these articles:
{% link https://dev.to/stanleyowen/build-a-login-and-register-form-with-html-and-css-1nkl %}

{% link https://dev.to/stanleyowen/todo-application-an-open-source-and-easy-to-use-web-application-f55 %}

{% link https://dev.to/stanleyowen/fire-ui-a-user-friendly-and-reliable-css-framework-229d %}