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.edit_help_url = edit_help_url
self.route_prefix = route_prefix self.route_prefix = route_prefix
self.button_icon_submit = kwargs.get('button_icon_submit', 'save')
def __iter__(self): def __iter__(self):
return iter(self.fields) return iter(self.fields)

View file

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

View file

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