Passed
Pull Request — master (#259)
by Piotr
01:09
created

password_reset_email()   A

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
1
from djoser import utils
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
from djoser.conf import settings
3
4
5
def activation_email(request, context):
6
    """
7
    Side effect of updating is_active field to False
8
    """
9
    utils.validate_context_user_for_email(context)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named validate_context_user_for_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
10
    user = context['user']
11
12
    user_email = utils.get_user_email(user)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named get_user_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
13
    assert user_email is not None
14
    to = [user_email]
0 ignored issues
show
Coding Style Naming introduced by
The name to does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
15
    settings.EMAIL.activation(request, context).send(to)
16
17
    user.is_active = False
18
    user.save(update_fields=['is_active'])
19
20
21
def confirmation_email(request, context):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
22
    utils.validate_context_user_for_email(context)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named validate_context_user_for_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
23
    user = context['user']
24
25
    user_email = utils.get_user_email(user)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named get_user_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
26
    assert user_email is not None
27
    to = [user_email]
0 ignored issues
show
Coding Style Naming introduced by
The name to does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
28
    settings.EMAIL.confirmation(request, context).send(to)
29
30
31
def password_reset_email(request, context):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
32
    utils.validate_context_user_for_email(context)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named validate_context_user_for_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
33
    user = context['user']
34
35
    user_email = utils.get_user_email(user)
0 ignored issues
show
Bug introduced by
The Module djoser.utils does not seem to have a member named get_user_email.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
36
    assert user_email is not None
37
    to = [user_email]
0 ignored issues
show
Coding Style Naming introduced by
The name to does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
38
    settings.EMAIL.password_reset(request, context).send(to)
39