Merge pull request #337 from dod-ccpo/user-profile-screen
User profile screen
This commit is contained in:
70
atst/forms/edit_user.py
Normal file
70
atst/forms/edit_user.py
Normal file
@@ -0,0 +1,70 @@
|
||||
import pendulum
|
||||
from wtforms.fields.html5 import DateField, EmailField, TelField
|
||||
from wtforms.fields import RadioField, StringField
|
||||
from wtforms.validators import Email, Required
|
||||
|
||||
from .fields import SelectField
|
||||
from .forms import ValidatedForm
|
||||
from .data import SERVICE_BRANCHES
|
||||
|
||||
from .validators import Alphabet, DateRange, PhoneNumber
|
||||
|
||||
|
||||
class EditUserForm(ValidatedForm):
|
||||
|
||||
first_name = StringField("First Name", validators=[Required(), Alphabet()])
|
||||
|
||||
last_name = StringField("Last Name", validators=[Required(), Alphabet()])
|
||||
|
||||
email = EmailField(
|
||||
"E-mail Address",
|
||||
description="Enter your preferred contact e-mail address",
|
||||
validators=[Required(), Email()],
|
||||
)
|
||||
|
||||
phone_number = TelField(
|
||||
"Phone Number",
|
||||
description="Enter your 10-digit U.S. phone number",
|
||||
validators=[Required(), PhoneNumber()],
|
||||
)
|
||||
|
||||
service_branch = SelectField(
|
||||
"Service Branch or Agency",
|
||||
description="Which service or organization do you belong to within the DoD?",
|
||||
choices=SERVICE_BRANCHES,
|
||||
)
|
||||
|
||||
citizenship = RadioField(
|
||||
description="What is your citizenship status?",
|
||||
choices=[
|
||||
("United States", "United States"),
|
||||
("Foreign National", "Foreign National"),
|
||||
("Other", "Other"),
|
||||
],
|
||||
validators=[Required()],
|
||||
)
|
||||
|
||||
designation = RadioField(
|
||||
"Designation of Person",
|
||||
description="What is your designation within the DoD?",
|
||||
choices=[
|
||||
("military", "Military"),
|
||||
("civilian", "Civilian"),
|
||||
("contractor", "Contractor"),
|
||||
],
|
||||
validators=[Required()],
|
||||
)
|
||||
|
||||
date_latest_training = DateField(
|
||||
"Latest Information Assurance (IA) Training Completion Date",
|
||||
description='To complete the training, you can find it in <a class="icon-link" href="https://iatraining.disa.mil/eta/disa_cac2018/launchPage.htm" target="_blank">Information Assurance Cyber Awareness Challange</a> website.',
|
||||
validators=[
|
||||
Required(),
|
||||
DateRange(
|
||||
lower_bound=pendulum.duration(years=1),
|
||||
upper_bound=pendulum.duration(days=0),
|
||||
message="Must be a date within the last year.",
|
||||
),
|
||||
],
|
||||
format="%m/%d/%Y",
|
||||
)
|
@@ -7,6 +7,7 @@ from atst.domain.users import Users
|
||||
from atst.domain.authnid import AuthenticationContext
|
||||
from atst.domain.audit_log import AuditLog
|
||||
from atst.domain.auth import logout as _logout
|
||||
from atst.forms.edit_user import EditUserForm
|
||||
|
||||
|
||||
bp = Blueprint("atst", __name__)
|
||||
@@ -89,3 +90,16 @@ def logout():
|
||||
def activity_history():
|
||||
audit_events = AuditLog.get_all_events(g.current_user)
|
||||
return render_template("audit_log.html", audit_events=audit_events)
|
||||
|
||||
|
||||
@bp.route("/user")
|
||||
def user():
|
||||
form = EditUserForm(request.form)
|
||||
user = g.current_user
|
||||
return render_template("user/edit.html", form=form, user=user)
|
||||
|
||||
|
||||
@bp.route("/save_user")
|
||||
def save_user():
|
||||
# no op
|
||||
return redirect(url_for(".home"))
|
||||
|
Reference in New Issue
Block a user