diff --git a/app/blueprints/users/account.py b/app/blueprints/users/account.py index 458d382..c996541 100644 --- a/app/blueprints/users/account.py +++ b/app/blueprints/users/account.py @@ -33,8 +33,8 @@ from . import bp class LoginForm(FlaskForm): username = StringField("Username or email", [InputRequired()]) password = PasswordField("Password", [InputRequired(), Length(6, 100)]) - remember_me = BooleanField("Remember me") - submit = SubmitField("Login") + remember_me = BooleanField("Remember me", default=True) + submit = SubmitField("Sign in") def handle_login(form): @@ -86,6 +86,9 @@ def login(): if ret: return ret + if request.method == "GET": + form.remember_me.data = True + return render_template("users/login.html", form=form) diff --git a/app/scss/components.scss b/app/scss/components.scss index 8e5c6bc..31b7268 100644 --- a/app/scss/components.scss +++ b/app/scss/components.scss @@ -169,3 +169,43 @@ blockquote { margin-bottom: 0.5em; } } + + +.signin { + width: 100%; + max-width: 330px; + padding: 15px; + margin: 0 auto; + + .form-control { + position: relative; + box-sizing: border-box; + height: auto; + padding: 10px; + font-size: 16px; + } + + .form-group { + margin-bottom: 0; + } + + .form-control:focus { + z-index: 2; + } + + .checkbox { + font-weight: 400; + } + + input[type="text"] { + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; + } + + input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; + } +} diff --git a/app/templates/base.html b/app/templates/base.html index 5c4f9a7..842e8bf 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -7,7 +7,7 @@ {% block title %}title{% endblock %} - {{ config.USER_APP_NAME }} - + diff --git a/app/templates/macros/forms.html b/app/templates/macros/forms.html index 3ae43c3..7369dbb 100644 --- a/app/templates/macros/forms.html +++ b/app/templates/macros/forms.html @@ -6,9 +6,9 @@ {% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None, hint=None) -%}
- {% if field.type != 'HiddenField' and label_visible %} + {% if field.type != 'HiddenField' %} {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} - {% if label %}{% endif %} + {% if label %}{% endif %} {% endif %} {{ field(class_=fieldclass or 'form-control', **kwargs) }} {% if hint %} diff --git a/app/templates/users/login.html b/app/templates/users/login.html index cef1bb0..f44bf7a 100644 --- a/app/templates/users/login.html +++ b/app/templates/users/login.html @@ -1,64 +1,39 @@ {% extends "base.html" %} {% block title %} -Sign in + Sign in {% endblock %} -{% block content %} -
-
-
- {% from "macros/forms.html" import render_field, render_checkbox_field, render_submit_field %} -

{%trans%}Sign in{%endtrans%}

+{% block container %} +
+ {% from "macros/forms.html" import render_field, render_checkbox_field, render_submit_field %} + -
- -
-

{%trans%}Sign in with Github{%endtrans%}

-
- GitHub + {{ render_field(form.username, tabindex=110, label_visible=False, placeholder=_("Username or email")) }} + {{ render_field(form.password, tabindex=120, label_visible=False, placeholder=_("Password")) }} +
+ {{ render_checkbox_field(form.remember_me, tabindex=130, class_="col-sm") }} + + {{ _("Forgot my password") }} +
-
-
+ {{ render_submit_field(form.submit, tabindex=140, class_="btn btn-lg btn-primary btn-block") }} - -
+

+ + + {{ _("GitHub") }} + + + + {{ _("Register") }} + +

+ + {% endblock %}