|
4 | 4 | from flask import Blueprint, current_app as app, flash, jsonify, redirect, render_template, request, session, url_for
|
5 | 5 | from flask_babel import format_datetime
|
6 | 6 | from kqueen_ui.api import get_kqueen_client
|
7 |
| -from kqueen_ui.config.auth import AuthModules |
| 7 | +from kqueen_ui.auth import AUTH_MODULES |
8 | 8 | from kqueen_ui.auth import generate_confirmation_token
|
9 | 9 | from kqueen_ui.blueprints.ui.utils import generate_password, sanitize_resource_metadata
|
10 | 10 | from kqueen_ui.generic_views import KQueenView
|
@@ -171,33 +171,31 @@ class MemberCreate(KQueenView):
|
171 | 171 | def handle(self, organization_id):
|
172 | 172 | form_cls = MemberCreateForm
|
173 | 173 |
|
174 |
| - modules = AuthModules() |
175 |
| - auth_options = modules.__dict__ |
176 |
| - logger.debug('Available Auth options {}'.format(auth_options)) |
177 |
| - |
178 |
| - if auth_options: |
179 |
| - auth_choices = [] |
180 |
| - for name, options in auth_options.items(): |
181 |
| - choice = (name, options.get('label', name)) |
182 |
| - auth_choices.append(choice) |
183 |
| - field_kw = { |
184 |
| - 'auth_method': { |
185 |
| - 'type': 'select', |
186 |
| - 'label': 'Authentication Method', |
187 |
| - 'choices': auth_choices, |
188 |
| - 'validators': { |
189 |
| - 'required': True |
190 |
| - } |
| 174 | + logger.debug('Available Auth options {}'.format(AUTH_MODULES)) |
| 175 | + |
| 176 | + auth_choices = [] |
| 177 | + for name, options in AUTH_MODULES.items(): |
| 178 | + choice = (name, options.get('label', name)) |
| 179 | + auth_choices.append(choice) |
| 180 | + field_kw = { |
| 181 | + 'auth_method': { |
| 182 | + 'type': 'select', |
| 183 | + 'label': 'Authentication Method', |
| 184 | + 'choices': auth_choices, |
| 185 | + 'validators': { |
| 186 | + 'required': True |
191 | 187 | }
|
192 | 188 | }
|
193 |
| - form_cls.append_fields(field_kw) |
| 189 | + } |
| 190 | + |
| 191 | + form_cls.append_fields(field_kw) |
194 | 192 | form = form_cls()
|
195 | 193 | if form.validate_on_submit():
|
196 | 194 | auth_method = 'local'
|
197 | 195 | notify = True
|
198 | 196 | if hasattr(form, 'auth_method'):
|
199 | 197 | auth_method = form.auth_method.data
|
200 |
| - notify = auth_options.get(auth_method, {}).get('notify', True) |
| 198 | + notify = AUTH_MODULES.get(auth_method, {}).get('notify', True) |
201 | 199 | password = ''
|
202 | 200 | active = True
|
203 | 201 | if auth_method == 'local':
|
|
0 commit comments