User
User management module for Flask-Login integration.
This module provides user authentication and management functionality by extending Flask-Login's UserMixin class.
User
Bases: UserMixin
User class for authentication and session management.
This class extends Flask-Login's UserMixin to provide user authentication functionality with MongoDB backend storage.
Attributes:
Name | Type | Description |
---|---|---|
email |
str
|
User's email address (unique identifier) |
name |
str
|
User's first name |
surname |
str
|
User's last name |
complete_name |
str
|
User's full name (first + last) |
mongodb_id |
str
|
MongoDB document ID for the user |
Methods:
Name | Description |
---|---|
get_id |
Get user identifier for Flask-Login |
load_user |
Load user from database by email |
Source code in apps/annotator/code/forms/user.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
__init__(email)
Initialize user from database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
str
|
User's email address |
required |
Source code in apps/annotator/code/forms/user.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
get_id()
Get user identifier for Flask-Login.
Returns:
Type | Description |
---|---|
str
|
User's email address |
Source code in apps/annotator/code/forms/user.py
58 59 60 61 62 63 64 65 66 67 |
|
load_user(email)
Load user from database by email.
Used by Flask-Login to reload the user object from the user ID stored in the session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
email
|
str
|
User's email address |
required |
Returns:
Type | Description |
---|---|
User or None
|
User object if found, None otherwise |
Source code in apps/annotator/code/forms/user.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|