mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #2158 from martenson/improve-activation
activation config touch
This commit is contained in:
@@ -409,12 +409,11 @@ paste.app_factory = galaxy.web.buildapp:app_factory
|
||||
|
||||
# Activation grace period (in hours). Activation is not forced (login is not
|
||||
# disabled) until grace period has passed. Users under grace period can't run
|
||||
# jobs (see inactivity_box_content). Default is 3. Enter 0 to disable grace
|
||||
# period.
|
||||
# jobs. Enter 0 to disable grace period.
|
||||
# Users with OpenID logins have grace period forever.
|
||||
#activation_grace_period = 0
|
||||
#activation_grace_period = 3
|
||||
|
||||
# Used for warning box for inactive accounts (unable to run jobs).
|
||||
# Shown in warning box to users that were not activated yet.
|
||||
# In use only if activation_grace_period is set.
|
||||
#inactivity_box_content = Your account has not been activated yet. Feel free to browse around and see what's available, but you won't be able to upload data or run jobs until you have verified your email address.
|
||||
|
||||
|
||||
@@ -197,8 +197,10 @@ class Configuration( object ):
|
||||
activation_email = kwargs.get( 'activation_email', None )
|
||||
self.email_from = kwargs.get( 'email_from', activation_email )
|
||||
self.user_activation_on = string_as_bool( kwargs.get( 'user_activation_on', False ) )
|
||||
self.activation_grace_period = kwargs.get( 'activation_grace_period', None )
|
||||
self.inactivity_box_content = kwargs.get( 'inactivity_box_content', None )
|
||||
self.activation_grace_period = int( kwargs.get( 'activation_grace_period', 3 ) )
|
||||
default_inactivity_box_content = ( "Your account has not been activated yet. Feel free to browse around and see what's available, but"
|
||||
" you won't be able to upload data or run jobs until you have verified your email address." )
|
||||
self.inactivity_box_content = kwargs.get( 'inactivity_box_content', default_inactivity_box_content )
|
||||
self.terms_url = kwargs.get( 'terms_url', None )
|
||||
self.instance_resource_url = kwargs.get( 'instance_resource_url', None )
|
||||
self.registration_warning_message = kwargs.get( 'registration_warning_message', None )
|
||||
|
||||
@@ -48,7 +48,6 @@ class RootController( controller.JSAppLauncher, UsesAnnotations ):
|
||||
|
||||
def _get_extended_config( self, trans ):
|
||||
app = trans.app
|
||||
configured_for_inactivity_warning = app.config.user_activation_on and app.config.inactivity_box_content is not None
|
||||
user_requests = bool( trans.user and ( trans.user.requests or app.security_agent.get_accessible_request_types( trans, trans.user ) ) )
|
||||
config = {
|
||||
'active_view' : 'analysis',
|
||||
@@ -59,7 +58,7 @@ class RootController( controller.JSAppLauncher, UsesAnnotations ):
|
||||
'toolbox' : app.toolbox.to_dict( trans, in_panel=False ),
|
||||
'toolbox_in_panel' : app.toolbox.to_dict( trans ),
|
||||
'message_box_visible' : app.config.message_box_visible,
|
||||
'show_inactivity_warning' : configured_for_inactivity_warning and trans.user and not trans.user.active,
|
||||
'show_inactivity_warning' : app.config.user_activation_on and trans.user and not trans.user.active,
|
||||
# TODO: move to user
|
||||
'user_requests' : user_requests
|
||||
}
|
||||
|
||||
@@ -633,9 +633,6 @@ class User( BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Creat
|
||||
"""
|
||||
# Activation is forced and the user is not active yet. Check the grace period.
|
||||
activation_grace_period = trans.app.config.activation_grace_period
|
||||
# Default value is 3 hours.
|
||||
if activation_grace_period is None:
|
||||
activation_grace_period = 3
|
||||
delta = timedelta( hours=int( activation_grace_period ) )
|
||||
time_difference = datetime.utcnow() - create_time
|
||||
return ( time_difference > delta or activation_grace_period == 0 )
|
||||
|
||||
@@ -81,9 +81,7 @@ class Configuration( object ):
|
||||
# Galaxy flavor Docker Image
|
||||
self.enable_galaxy_flavor_docker_image = string_as_bool( kwargs.get( "enable_galaxy_flavor_docker_image", "False" ) )
|
||||
self.use_remote_user = string_as_bool( kwargs.get( "use_remote_user", "False" ) )
|
||||
self.user_activation_on = kwargs.get( 'user_activation_on', None )
|
||||
self.activation_grace_period = kwargs.get( 'activation_grace_period', None )
|
||||
self.inactivity_box_content = kwargs.get( 'inactivity_box_content', None )
|
||||
self.user_activation_on = None
|
||||
self.registration_warning_message = kwargs.get( 'registration_warning_message', None )
|
||||
self.terms_url = kwargs.get( 'terms_url', None )
|
||||
self.blacklist_location = kwargs.get( 'blacklist_file', None )
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
self.message_box_visible = app.config.message_box_visible
|
||||
self.show_inactivity_warning = False
|
||||
if trans.webapp.name == 'galaxy' and trans.user:
|
||||
self.show_inactivity_warning = ( ( trans.user.active is False ) and ( app.config.user_activation_on ) and ( app.config.inactivity_box_content is not None ) )
|
||||
self.show_inactivity_warning = ( ( trans.user.active is False ) and ( app.config.user_activation_on ) )
|
||||
self.overlay_visible=False
|
||||
self.active_view=None
|
||||
self.body_class=""
|
||||
|
||||
Reference in New Issue
Block a user