| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  | #!/usr/bin/python | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import getpass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import src.my_scrypt | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | import src.sql | 
					
						
							|  |  |  | import src.change_password | 
					
						
							| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 21:06:09 -04:00
										 |  |  | config = src.config_provider.getConfig() | 
					
						
							|  |  |  | src.sql.connect(config['Document']['documentPath']) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | current_password = getpass.getpass(prompt="Enter current password: ") | 
					
						
							| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | new_password1 = getpass.getpass(prompt="Enter new password: ") | 
					
						
							|  |  |  | new_password2 = getpass.getpass(prompt="Repeat the same password: ") | 
					
						
							| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | if new_password1 != new_password2: | 
					
						
							| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  |     print('Entered passwords are not identical!') | 
					
						
							|  |  |  |     exit(-1) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | ret = src.change_password.change_password(current_password, new_password1) | 
					
						
							| 
									
										
										
										
											2017-09-09 13:53:58 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 22:09:09 -04:00
										 |  |  | if (ret['success']): | 
					
						
							|  |  |  |     print("Changes committed. All encrypted notes were re-encrypted successfully with new password key.") | 
					
						
							|  |  |  |     print("You can now start application and login with new password.") | 
					
						
							|  |  |  | else: | 
					
						
							|  |  |  |     print(ret['message']) |