Merge branch 'error-note' into 'master'

Use note of type=error to signal an error

See merge request sjehuda/slixfeed!4
This commit is contained in:
Schimon Jehudah 2024-02-13 21:07:57 +00:00
commit 12689b8ef1

View file

@ -771,6 +771,7 @@ class Slixfeed(slixmpp.ClientXMPP):
options.addOption(conference['name'], conference['jid']) options.addOption(conference['name'], conference['jid'])
session['next'] = self._handle_bookmarks_editor session['next'] = self._handle_bookmarks_editor
session['has_next'] = True session['has_next'] = True
session['payload'] = form
else: else:
logging.warning('An unauthorized attempt to access bookmarks has ' logging.warning('An unauthorized attempt to access bookmarks has '
'been detected!\n' 'been detected!\n'
@ -778,16 +779,7 @@ class Slixfeed(slixmpp.ClientXMPP):
' Jabber ID: {}\n' ' Jabber ID: {}\n'
' Timestamp: {}\n' ' Timestamp: {}\n'
.format(jid, timestamp())) .format(jid, timestamp()))
form = self['xep_0004'].make_form('form', 'Denied') session['notes'] = [['error', 'You are not allowed to access this resource.']]
# form = self['xep_0004'].make_form('error', 'Denied') # Cheogram crashes
form['instructions'] = '⚠️ Access denied'
form.add_field(var='warning',
ftype='fixed',
label='Warning',
value='You are not allowed to access this resource.')
session['next'] = False
session['has_next'] = False
session['payload'] = form
return session return session