if rec['recipient_type'] == 'character': receipients.append(rec['recipient_id']) elif rec['recipient_type'] == 'alliance' or rec['recipient_type'] == 'corporation': if alliance_or_corp is not None or mailinglist_id is not None: raise ValueError("Only one alliance or corp or mailing list at maximum can be receipient of a mail") alliance_or_corp = rec['recipient_id'] elif rec['receipient_type'] == 'mailing_list': if mailinglist_id is not None or alliance_or_corp is not None: raise ValueError("Only one alliance or corp or mailing list at maximum can be receipient of a mail") mailinglist_id = rec['recipient_id'] response = open_mail(receipients, body, subject, alliance_or_corp, mailinglist_id) if response.is_error(): flask.abort(response.error(), response.code()) return make_response('', response.code()) def handle_sso_cb(tokens): handle_token_update(tokens) return redirect(url_for('feedback.settings')) @bp.route('/auth', methods=['GET']) @login_required @perm_manager.require('commandcore') def auth(): return get_sso_redirect('esi_ui', 'esi-ui.open_window.v1') add_sso_handler('esi_ui', handle_sso_cb)
"Setting new owner_hash for %s, invalidating all existing sessions", character) # delete any existing links (to other accounts) db.session.query(linked_chars) \ .filter((linked_chars.c.id != current_user.id) & (linked_chars.c.char_id == char_id)).delete(synchronize_session=False) db.session.commit() # add the new link current_user.characters.append(character) db.session.flush() send_alt_link_added(alt_verification_handler, current_user.id, current_user.id, character.id) if current_user.current_char != char_id: current_user.current_char = char_id db.session.commit() flash( gettext('Alt %(char_name)s was added', char_name=character.eve_name), 'info') return redirect(url_for('accounts.account_self'), code=303) else: flask.abort( 400, 'Could not confirm your authorisation of the alt,' ' most likely you authenticated a wrong character.') add_sso_handler('alt_verification', alt_verification_handler)
if not config.require_auth_for_chars: return login_account_by_username_or_character(char, owner_hash, token) return login_accounts_by_alts_or_character(char, owner_hash, token) def invalidate_all_sessions_for_current_user() -> None: """ Invalidates all active session for the current user. Not just the current session like force_logout() This needs to be called before calling force_logout() :return: Nothing """ invalidate_all_sessions_for_given_user(current_user) def invalidate_all_sessions_for_given_user( user: Union[Character, Account]) -> None: """ Invalidates all active session for the given user. Not just the current session like force_logout() This needs to be called before calling force_logout() :return: Nothing """ user.session_key = user.session_key + 1 db.session.commit() add_sso_handler('linelogin', member_login_cb)
'sender_character_id': current_user.get_eve_id(), 'target_character_id': acc.current_char, 'mail_body': body, 'subject': subject } db.session.add(history_entry) db.session.commit() else: esi_resp: ESIResponse = make_error_response(resp) if esi_resp.is_monolith_error(): return make_response(esi_resp.get_monolith_error()['error_label'], resp.status) return make_response( str(resp.data) if resp.data is not None else '', resp.status) def handle_mail_sso_cb(tokens): add_token(tokens) return redirect(url_for('accounts.accounts')) @bp.route('/auth', methods=['GET']) @login_required @perm_manager.require('send_mail') def auth(): return get_sso_redirect('mail', 'esi-mail.send_mail.v1') add_sso_handler('mail', handle_mail_sso_cb)
fleets_manage = perm_manager.get_permission('fleet_management') perm_dev = perm_manager.get_permission('developer_tools') @login_required @fleets_manage.require(http_exception=401) def handle_new_fleet_token(tokens): add_token(tokens) return redirect(url_for('fleet.take_over_fleet')) ''' register sso handler ''' add_sso_handler('get_fleet_token', handle_new_fleet_token) ''' Steps: url == process the url and setup quads/motd if wanted selection == select which squads to invite too ''' @bp.route("/setup/<string:step>", methods=['POST']) @login_required @fleets_manage.require(http_exception=401) def setup_steps(step: str) -> Any: if step == 'url': return setup_step_url() elif step == "select": return setup_step_select()
) alliance_or_corp = rec['recipient_id'] elif rec['recipient_type'] == 'mailing_list': if mailinglist_id is not None or alliance_or_corp is not None: raise ValueError( "Only one alliance or corp or mailing list at maximum can be receipient of a mail" ) mailinglist_id = rec['recipient_id'] response = open_mail(token, receipients, body, subject, alliance_or_corp, mailinglist_id) if response.is_error(): flask.abort(response.error(), response.code()) return make_response('', response.code()) def handle_open_ui_sso_cb(tokens): add_token(tokens) return redirect(url_for('feedback.settings')) @bp.route('/auth', methods=['GET']) @login_required @perm_manager.require('commandcore') def auth(): return get_sso_redirect('esi_ui', 'esi-ui.open_window.v1') add_sso_handler('esi_ui', handle_open_ui_sso_cb)