Add new config "enable_login".
This commit is contained in:
		
							parent
							
								
									797b3376a7
								
							
						
					
					
						commit
						4fc203634c
					
				
					 3 changed files with 5 additions and 0 deletions
				
			
		|  | @ -156,6 +156,7 @@ DEFAULT_CONFIGURATION = { | |||
|     'cache_size_user': 200, | ||||
| 
 | ||||
|     'enable_album_edit': True, | ||||
|     'enable_login': True, | ||||
|     'enable_new_album': True, | ||||
|     'enable_new_bookmark': True, | ||||
|     'enable_new_photo': True, | ||||
|  |  | |||
|  | @ -1006,6 +1006,7 @@ class PDBUserMixin: | |||
|             author_id = None | ||||
|         return author_id | ||||
| 
 | ||||
|     @decorators.required_feature('enable_login') | ||||
|     def login(self, user_id, password): | ||||
|         cur = self.sql.cursor() | ||||
|         cur.execute('SELECT * FROM users WHERE id == ?', [user_id]) | ||||
|  |  | |||
|  | @ -648,6 +648,9 @@ def post_login(): | |||
|         e = etiquette.exceptions.WrongLogin() | ||||
|         response = etiquette.jsonify.exception(e) | ||||
|         return jsonify.make_json_response(response, status=422) | ||||
|     except etiquette.exceptions.FeatureDisabled as e: | ||||
|         response = etiquette.jsonify.exception(e) | ||||
|         return jsonify.make_json_response(response, status=400) | ||||
|     session = sessions.Session(request, user) | ||||
|     session_manager.add(session) | ||||
|     return jsonify.make_json_response({}) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue