Change Master Password feature added.
This commit is contained in:
		| @@ -57,13 +57,17 @@ public class CasaMain | |||||||
| 						dialogConfirmRefresh, | 						dialogConfirmRefresh, | ||||||
| 						dialogSingleInstance, | 						dialogSingleInstance, | ||||||
| 						dialogLoginReprompt, | 						dialogLoginReprompt, | ||||||
| 						dialogShortPassword; | 						dialogShortPassword, | ||||||
|  | 						dialogResetMP; | ||||||
| 						 | 						 | ||||||
| 	[Glade.Widget]  | 	[Glade.Widget]  | ||||||
| 	Gtk.Entry	 		entryMasterPassword1,  | 	Gtk.Entry	 		entryMasterPassword1,  | ||||||
| 						entryMasterPassword2,  | 						entryMasterPassword2,  | ||||||
| 						entryMasterPassword3,  | 						entryMasterPassword3,  | ||||||
| 						entryMasterPassword4; | 						entryMasterPassword4, | ||||||
|  | 						entryOldMP, | ||||||
|  | 						entryNewMP1, | ||||||
|  | 						entryNewMP2; | ||||||
| 						 | 						 | ||||||
| 	[Glade.Widget]  | 	[Glade.Widget]  | ||||||
| 	Gtk.CheckButton		checkbuttonFirefox,  | 	Gtk.CheckButton		checkbuttonFirefox,  | ||||||
| @@ -172,6 +176,7 @@ public class CasaMain | |||||||
| 		{	      		 | 		{	      		 | ||||||
| 			MasterPasswordAuthentication();                       		 | 			MasterPasswordAuthentication();                       		 | ||||||
|  |  | ||||||
|  | 			 | ||||||
| 			if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) | 			if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) | ||||||
| 			{ | 			{ | ||||||
| 				try  | 				try  | ||||||
| @@ -181,6 +186,7 @@ public class CasaMain | |||||||
| 				} | 				} | ||||||
| 				catch{} | 				catch{} | ||||||
| 			} | 			} | ||||||
|  | 						 | ||||||
| 		} | 		} | ||||||
| 		else | 		else | ||||||
| 		{			 | 		{			 | ||||||
| @@ -951,6 +957,87 @@ public class CasaMain | |||||||
|     } |     } | ||||||
|      |      | ||||||
|  |  | ||||||
|  | 	///####################################################################### | ||||||
|  | 	/// Reset Master Password CALLED VIA MAIN MENU | ||||||
|  |      | ||||||
|  | 	/// <summary> | ||||||
|  | 	///  | ||||||
|  | 	/// </summary> | ||||||
|  | 	public void ResetMasterPassword(object obj, EventArgs args) | ||||||
|  | 	{    	    	 | ||||||
|  | 		Logger.DbgLog("GUI:CasaMain.ResetMasterPassword() - BEGIN"); | ||||||
|  |     	 | ||||||
|  | 		Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogResetMP", null); | ||||||
|  | 		gxmlTemp.Autoconnect (this); | ||||||
|  | 		dialogResetMP.TransientFor = windowMain; | ||||||
|  | 		entryOldMP.Text=""; | ||||||
|  | 		entryNewMP1.Text=""; | ||||||
|  | 		entryNewMP2.Text="";			         | ||||||
|  | 		Logger.DbgLog("GUI:CasaMain.ResetMasterPassword() - END");          	          	          	          	         | ||||||
|  | 	}     | ||||||
|  |      | ||||||
|  | 	public void okbuttonResetMasterPWD_clicked(object abj, EventArgs args) | ||||||
|  | 	{ | ||||||
|  | 		Logger.DbgLog("GUI:CasaMain.okbuttonResetMasterPWD_clicked() - BEGIN"); | ||||||
|  |     	 | ||||||
|  | 		if (entryOldMP.Text == "") | ||||||
|  | 		{ | ||||||
|  | 			DisplayError("You must enter you current Master Password"); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// check Current MP | ||||||
|  | 		if (entryOldMP.Text != "") | ||||||
|  | 		{ | ||||||
|  | 			int rcode = miCASA.SetMasterPassword(1, entryOldMP.Text); | ||||||
|  | 			if (rcode != 0) | ||||||
|  | 			{ | ||||||
|  | 				DisplayError("Current Master Password is not correct"); | ||||||
|  | 				return; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		if (entryNewMP1.Text.Length < 8) | ||||||
|  | 		{ | ||||||
|  | 			Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogShortPassword", null); | ||||||
|  | 			gxmlTemp.Autoconnect (this); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		if (entryNewMP1.Text != entryNewMP2.Text) | ||||||
|  | 		{ | ||||||
|  | 			DisplayError("New Master Passwords do not match"); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		if (miCASA.ChangeMasterPassword(entryOldMP.Text, entryNewMP1.Text)) | ||||||
|  | 			dialogResetMP.Destroy(); | ||||||
|  | 		else | ||||||
|  | 			DisplayError("Change failed"); | ||||||
|  | 		    	 | ||||||
|  | 		Logger.DbgLog("GUI:CasaMain.okbuttonResetMasterPWD_clicked() - END"); | ||||||
|  | 	} | ||||||
|  |      | ||||||
|  | 	public void cancelbuttonResetMasterPWD_clicked(object abj, EventArgs args) | ||||||
|  | 	{ | ||||||
|  | 		dialogResetMP.Destroy(); | ||||||
|  | 	}	 | ||||||
|  |  | ||||||
|  | 	private void DisplayError(String sErrorMessage) | ||||||
|  | 	{ | ||||||
|  | 		MessageDialog md = new MessageDialog(windowMain, | ||||||
|  | 			Gtk.DialogFlags.Modal, | ||||||
|  | 			Gtk.MessageType.Warning, | ||||||
|  | 			Gtk.ButtonsType.Close, | ||||||
|  | 			sErrorMessage); | ||||||
|  |  | ||||||
|  | 		md.Response +=new ResponseHandler(md_Response); | ||||||
|  | 		//md_ResponseCloseWindow | ||||||
|  | 		md.Show(); | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  |            | ||||||
|      |      | ||||||
|     ///####################################################################### |     ///####################################################################### | ||||||
|     /// PERSISTENT STORAGE CALLED VIA MAIN MENU |     /// PERSISTENT STORAGE CALLED VIA MAIN MENU | ||||||
|   | |||||||
| @@ -99,8 +99,8 @@ namespace Novell.CASA.GUI | |||||||
| 					+ ": Exception encountered - "); | 					+ ": Exception encountered - "); | ||||||
| 				tsLog.AppendValues(message); | 				tsLog.AppendValues(message); | ||||||
|  |  | ||||||
| 				StackTrace st = new StackTrace(); | 				StackTrace st1 = new StackTrace(); | ||||||
| 				tsLog.AppendValues(st.ToString());				 | 				tsLog.AppendValues(st1.ToString());				 | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| #if DEBUG | #if DEBUG | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user