parent
							
								
									0954240ccb
								
							
						
					
					
						commit
						3a473cad2a
					
				
					 5 changed files with 52 additions and 5 deletions
				
			
		|  | @ -562,7 +562,7 @@ class Signin(ApiResource): | |||
|         'invite_code': { | ||||
|           'type': 'string', | ||||
|           'description': 'The optional invite code' | ||||
|         } | ||||
|         }, | ||||
|       }, | ||||
|     }, | ||||
|   } | ||||
|  | @ -579,7 +579,6 @@ class Signin(ApiResource): | |||
|     username = signin_data['username'] | ||||
|     password = signin_data['password'] | ||||
|     invite_code = signin_data.get('invite_code', '') | ||||
| 
 | ||||
|     return conduct_signin(username, password, invite_code=invite_code) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ from config import frontend_visible_config | |||
| from external_libraries import get_external_javascript, get_external_css | ||||
| from util.names import parse_namespace_repository | ||||
| from util.secscan import PRIORITY_LEVELS | ||||
| from util.timedeltastring import convert_to_timedelta | ||||
| 
 | ||||
| 
 | ||||
| logger = logging.getLogger(__name__) | ||||
|  | @ -108,16 +109,20 @@ def param_required(param_name, allow_body=False): | |||
|   return wrapper | ||||
| 
 | ||||
| 
 | ||||
| def common_login(db_user): | ||||
| def common_login(db_user, permanent_session=True): | ||||
|   if login_user(LoginWrappedDBUser(db_user.uuid, db_user)): | ||||
|     logger.debug('Successfully signed in as: %s (%s)' % (db_user.username, db_user.uuid)) | ||||
|     new_identity = QuayDeferredPermissionUser.for_user(db_user) | ||||
|     identity_changed.send(app, identity=new_identity) | ||||
|     session['login_time'] = datetime.datetime.now() | ||||
| 
 | ||||
|     if permanent_session and features.PERMANENT_SESSIONS: | ||||
|       session_timeout_str = app.config.get('SESSION_TIMEOUT', '31d') | ||||
|       session.permanent = True | ||||
|       session.permanent_session_lifetime = convert_to_timedelta(session_timeout_str) | ||||
| 
 | ||||
|     # Inform our user analytics that we have a new "lead" | ||||
|     user_analytics.create_lead(db_user.email, db_user.username) | ||||
| 
 | ||||
|     return True | ||||
|   else: | ||||
|     logger.debug('User could not be logged in, inactive?.') | ||||
|  |  | |||
|  | @ -393,7 +393,6 @@ def confirm_email(): | |||
|     user_analytics.change_email(old_email, new_email) | ||||
| 
 | ||||
|   common_login(user) | ||||
| 
 | ||||
|   return redirect(url_for('web.user', tab='email') if new_email else url_for('web.index')) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue