protected void login_Click(object sender, EventArgs e) { GetAccountRequest request = new GetAccountRequest(); request.Account = tbAccountName.Text; Response <Account> account = _masterService.GetAccount(request); if (!account.Success) { lblError.Text = (String)GetLocalResourceObject(account.Message); } AccountRecoveryRequest recoverRequest = new AccountRecoveryRequest(); recoverRequest.Email = tbUsername.Text; PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(recoverRequest); if (response.Success) { X.Msg.Alert("Recovery", "Your Password has been sent to your email!"); //Redirecting.. Response.Redirect("Login.aspx", true); } else { lblError.Text = response.Summary;//(String)GetLocalResourceObject(response.Message); } }
public PasswordRecoveryResponse RequestPasswordRecovery(AccountRecoveryRequest request) { PasswordRecoveryResponse response = new PasswordRecoveryResponse(); Dictionary <string, string> headers = SessionHelper.GetAuthorizationHeadersForUser(); Dictionary <string, string> parameters = new Dictionary <string, string>(); RecordWebServiceResponse <UserInfo> userRecord = childRepo.RequestPasswordRecovery(headers, request.Parameters); response = CreateServiceResponse <PasswordRecoveryResponse>(userRecord); // if (response.Success) return(response); }
public JsonResult resentSMS(Guid guid) { PasswordRecoveryResponse response = _passwordRecoveryService.ResendSmsRecoveryConfirmation(guid); if (response.Error != null) { return(Json(new { Error = true, response.Error.Code, response.Error.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { Error = false, response.State, }, JsonRequestBehavior.AllowGet)); }
public JsonResult existPhone(string phone, Guid guid) { PasswordRecoveryResponse response = _passwordRecoveryService.CheckRecoveryPhone(phone, guid); if (response.Error != null) { return(Json(new { Error = true, response.Error.Code, response.Error.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { Error = false, response.State, }, JsonRequestBehavior.AllowGet)); }
public JsonResult setPassword(string pass, Guid guid) { PasswordRecoveryResponse response = _passwordRecoveryService.NewPasswordFromEmailRecoverySet(pass, guid); if (response.Error != null) { return(Json(new { Error = true, response.Error.Code, response.Error.Message }, JsonRequestBehavior.AllowGet)); } return(Json(new { Error = false, response.State }, JsonRequestBehavior.AllowGet)); }
protected void login_Click(object sender, EventArgs e) { ResetPasswordRequest request = new ResetPasswordRequest(); request.Email = Request.QueryString["email"]; request.Guid = Request.QueryString["guid"]; request.NewPassword = tbPassword.Text; PasswordRecoveryResponse response = _systemService.ResetPassword(request); if (response.Success) { X.Msg.Alert("Success", "Your Password Has been changed succesfully!"); Response.Redirect("~/Login.aspx"); } else { lblError.Text = "Could not Reset Password"; } }
protected void SaveNewRecord(object sender, DirectEventArgs e) { //Getting the id to check if it is an Add or an edit as they are managed within the same form. string id = e.ExtraParams["id"]; string obj = e.ExtraParams["values"]; UserInfo b = JsonConvert.DeserializeObject <UserInfo>(obj); b.recordId = id; // Define the object to add or edit as null if (employeeId.SelectedItem != null) { b.employeeId = employeeId.SelectedItem.Value; } if (string.IsNullOrEmpty(id)) { try { //New Mode //Step 1 : Fill The object and insert in the store PostRequest <UserInfo> request = new PostRequest <UserInfo>(); b.password = "******"; request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); if (!r.Success) //check if the insert failed { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, r.Summary).Show(); return; } b.recordId = r.recordId; AccountRecoveryRequest req = new AccountRecoveryRequest(); req.Email = b.email; PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(req); if (!response.Success) //check if the insert failed { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response.Summary).Show(); return; } else { //Add this record to the store this.Store1.Insert(0, b); //Display successful notification Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordSavingSucc }); this.EditRecordWindow.Close(); RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel; sm.DeselectAll(); sm.Select(b.recordId.ToString()); } } catch (Exception ex) { //Error exception displaying a messsage box X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show(); } } else { //Update Mode try { int index = Convert.ToInt32(id);//getting the id of the record PostRequest <UserInfo> request = new PostRequest <UserInfo>(); request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); //Step 1 Selecting the object or building up the object for update purpose //Step 2 : saving to store //Step 3 : Check if request fails if (!r.Success)//it maybe another check { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); return; } else { ModelProxy record = this.Store1.GetById(index); BasicInfoTab.UpdateRecord(record); record.Set("fullName", b.fullName); record.Commit(); Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordUpdatedSucc }); this.EditRecordWindow.Close(); } } catch (Exception ex) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); } } }