fix: use better icon for submit button on login page

This commit is contained in:
Lance Edgar 2024-09-09 08:32:28 -05:00
parent b9b8bbd2ea
commit 5e742eab17
3 changed files with 6 additions and 4 deletions

View file

@ -401,6 +401,8 @@ class Form(object):
self.edit_help_url = edit_help_url
self.route_prefix = route_prefix
self.button_icon_submit = kwargs.get('button_icon_submit', 'save')
def __iter__(self):
return iter(self.fields)

View file

@ -59,7 +59,7 @@
native-type="submit"
:disabled="${form.vue_component}Submitting"
icon-pack="fas"
icon-left="save">
icon-left="${form.button_icon_submit}">
{{ ${form.vue_component}Submitting ? "Working, please wait..." : "${form.button_label_submit}" }}
</b-button>
% else:

View file

@ -24,8 +24,6 @@
Auth Views
"""
from rattail.db.auth import set_user_password
import colander
from deform import widget as dfwidget
from pyramid.httpexceptions import HTTPForbidden
@ -104,6 +102,7 @@ class AuthenticationView(View):
form.save_label = "Login"
form.show_reset = True
form.show_cancel = False
form.button_icon_submit = 'user'
if form.validate():
user = self.authenticate_user(form.validated['username'],
form.validated['password'])
@ -185,7 +184,8 @@ class AuthenticationView(View):
schema = ChangePassword().bind(user=self.request.user, request=self.request)
form = forms.Form(schema=schema, request=self.request)
if form.validate():
set_user_password(self.request.user, form.validated['new_password'])
auth = self.app.get_auth_handler()
auth.set_user_password(self.request.user, form.validated['new_password'])
self.request.session.flash("Your password has been changed.")
return self.redirect(self.request.get_referrer())