diff --git a/undercover/routes.py b/undercover/routes.py index cb1ac99..65d6299 100644 --- a/undercover/routes.py +++ b/undercover/routes.py @@ -78,10 +78,8 @@ class CLForm(Form): ) def to_cl_data(self) -> CLData: - selected_letter = self.letterName.data or '1' - return CLData( - selectedLetter=int(selected_letter) - 1, + selectedLetter=int(self.letterName.data or '1') - 1, username=self.username.data, company=self.company.data, jobAndPronoun=self.jobAndPronoun.data, @@ -110,6 +108,8 @@ def render_index( @writing_blueprint.route('/login', methods=['POST', 'GET']) def login() -> Response | str: + if request.form.get('confirm-password'): + return create_account() if request.method == 'POST': username = request.form['login'] if db.login(username, request.form['password']): @@ -117,13 +117,7 @@ def login() -> Response | str: return redirect('/') return render_index(error="Invalid username or password", status=401) - return ''' -
- ''' + return render_index(status=404) @writing_blueprint.route('/logout', methods=['POST', 'GET']) @@ -191,11 +185,6 @@ def index_get() -> Response: return render_index(form=form) -@writing_blueprint.route('/create_account', methods=['GET']) -def create_account_page() -> str: - return render_template('create_account.jinja2') - - @writing_blueprint.route('/create_account', methods=['POST']) def create_account() -> Response: email_address = request.form['login'] diff --git a/undercover/static/styles.css b/undercover/static/styles.css index 474aedc..682d9cc 100644 --- a/undercover/static/styles.css +++ b/undercover/static/styles.css @@ -124,8 +124,9 @@ div.user { div.user form { display: flex; - flex-direction: column; + flex-direction: row; font-size: 70%; + justify-content: end; } div.user form div { @@ -170,6 +171,8 @@ div.user form input { transition-property: color, background-color; transition-duration: 135ms; transition-timing-function: ease-out; + width: min-content; + white-space: nowrap; } .black-white-button:hover { @@ -187,6 +190,9 @@ div.user form input { .user.logged-in { margin-bottom: 1em; } +.user.logged-out { + font-size: 110%; +} dl { display: flex; @@ -263,8 +269,49 @@ textarea { height: 100%; } +.modal { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + position: absolute; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + scroll-behavior: unset; + background-color: white;/*rgba(0, 0, 0, 0.4);*/ + transition-property: opacity; + transition-duration: 300ms; + transition-timing-function: ease-out; +} + +.modal-background { + background: none; +} + +.modal-content input { + margin-bottom: 2em; +} + +.modal-close-button { + position: absolute; + background: none; + border: none; + font-size: 2rem; + font-weight: bold; + color: #444; + margin: 0.25em; + top: 0; + right: 0; +} + +.modal-close-button:hover { + color: #000; +} + /* Small screens */ -@media only screen and (max-width: 1080px) { +@media only screen and (max-width: 720px) { body { width: 85vw; } @@ -305,7 +352,7 @@ textarea { } /* Big screens */ -@media only screen and (min-width: 1081px) { +@media only screen and (min-width: 721px) { body { min-height: 98%; width: 40vw; @@ -329,9 +376,6 @@ textarea { #closingText { width: 50%; } - div.user form { - flex-direction: row; - } div.user form input { font-size: 110%; padding: 0.5em; @@ -340,9 +384,32 @@ textarea { .login-button { padding: 0; } - .logged-in { + .user { position: absolute; top: 0.5em; right: 1em; } + .modal-background { + background-color: rgba(0, 0, 0, 0.3) + } + .modal-content { + width: 40%; + height: 75%; + position: relative; + border-radius: 3px; + } } + +.transparent { + pointer-events: none; + opacity: 0; +} + +#create-account-form div { + display: flex; + flex-direction: column; +} + +.hidden { + display: none; +} \ No newline at end of file diff --git a/undercover/templates/_formhelpers.jinja2 b/undercover/templates/_formhelpers.jinja2 index 5971558..642d6b2 100644 --- a/undercover/templates/_formhelpers.jinja2 +++ b/undercover/templates/_formhelpers.jinja2 @@ -22,3 +22,46 @@ {{ render_input(field, extra, **kwargs) }} {% endmacro %} + +{% macro modal() %} +{{ username }}
@@ -17,6 +39,13 @@You are working as a Guest.
- -