Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions app/LocalUser/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,26 @@


class DoConfirm(Resource):
"""
Confirm and activate a user account.

Args:
None

Returns:
A JSON document with the key 'success' set to True if the operation
is successful. Otherwise the key 'success' is set to False and the
field 'code' is set to the HTTP error code that represents a specific
reason when the account confirmation was rejected.

Raises:
None
"""

def post(self):
# Get values
email = request.form.get('email')
token = request.form.get('token')
email = request.form.get('email') # User account email address
token = request.form.get('token') # Token assigned to account during account registration

# Validate required fields
validation = Validation()
Expand Down Expand Up @@ -52,9 +67,13 @@ def post(self):
# Token is not for this user
return {'success': False, 'code': 510}

# Set user account status to 'Confirmed'
user.confirmed = True

# Delete the account confirmation token; it is no longer required
db.session.delete(confirm_token)

# Commit the user account changes
db.session.commit()

logging.info('LocalUser-controller: DoConfirm: success: %s', user.id)
Expand All @@ -63,6 +82,15 @@ def post(self):


class RequestConfirm(Resource):
"""
Send account confirmation request email to user

Args:
param1: User account email address

Returns:
JSON document detailing the success or failure of the request.
"""

def get(self, email):
# Get server URL
Expand Down
10 changes: 9 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@
app = Flask(__name__)

# Application version (major,minor,patch-level)
version = "1.1.2"
version = "1.1.3"

"""
Change Log

1.1.3 Added documentation around the user account registration process.

"""

db = None

# Load basic configurations
Expand Down