public GetByConfirmationCode ( string code ) : UserLogin | ||
code | string | A |
return | UserLogin |
/// <summary> /// Shows the reset success. /// </summary> private void ShowResetSuccess() { RockContext rockContext = new RockContext(); UserLoginService userLoginService = new UserLoginService( rockContext ); UserLogin user = userLoginService.GetByConfirmationCode( this.ConfirmationCode ); if ( user != null ) { string caption = GetAttributeValue( "PasswordResetCaption" ); if ( caption.Contains( "{1}" ) ) { caption = string.Format( caption, user.Person.FirstName, user.UserName ); } else if ( caption.Contains( "{0}" ) ) { caption = string.Format( caption, user.Person.FirstName ); } lResetSuccess.Text = caption; userLoginService.SetPassword( user, tbPassword.Text ); user.IsConfirmed = true; rockContext.SaveChanges(); pnlResetSuccess.Visible = true; } else { ShowCode(); } }
/// <summary> /// Shows the delete. /// </summary> private void ShowDelete() { RockContext rockContext = new RockContext(); UserLoginService userLoginService = new UserLoginService( rockContext ); UserLogin user = userLoginService.GetByConfirmationCode( this.ConfirmationCode ); if ( user != null ) { string caption = GetAttributeValue( "DeleteCaption" ); if ( caption.Contains( "{0}" ) ) { caption = string.Format( caption, user.UserName ); } lDelete.Text = caption; pnlDelete.Visible = true; } else { ShowCode(); } }
/// <summary> /// Shows the deleted. /// </summary> private void ShowDeleted() { RockContext rockContext = new RockContext(); UserLoginService userLoginService = new UserLoginService( rockContext ); UserLogin user = userLoginService.GetByConfirmationCode( this.ConfirmationCode ); if ( user != null ) { if ( CurrentUser != null && CurrentUser.UserName == user.UserName ) { var transaction = new Rock.Transactions.UserLastActivityTransaction(); transaction.UserId = CurrentUser.Id; transaction.LastActivityDate = RockDateTime.Now; transaction.IsOnLine = false; Rock.Transactions.RockQueue.TransactionQueue.Enqueue( transaction ); FormsAuthentication.SignOut(); } userLoginService.Delete( user ); rockContext.SaveChanges(); pnlDeleted.Visible = true; } else { ShowCode(); } }
/// <summary> /// Shows the reset success. /// </summary> private void ShowResetSuccess() { RockContext rockContext = new RockContext(); UserLoginService userLoginService = new UserLoginService( rockContext ); UserLogin user = userLoginService.GetByConfirmationCode( this.ConfirmationCode ); if ( user != null ) { if ( UserLoginService.IsPasswordValid( tbPassword.Text ) ) { string caption = GetAttributeValue( "PasswordResetCaption" ); if ( caption.Contains( "{1}" ) ) { caption = string.Format( caption, user.Person.FirstName, user.UserName ); } else if ( caption.Contains( "{0}" ) ) { caption = string.Format( caption, user.Person.FirstName ); } lResetSuccess.Text = caption; userLoginService.SetPassword( user, tbPassword.Text ); user.IsConfirmed = true; rockContext.SaveChanges(); pnlResetSuccess.Visible = true; } else { nbMessage.NotificationBoxType = Rock.Web.UI.Controls.NotificationBoxType.Danger; nbMessage.Text = UserLoginService.FriendlyPasswordRules(); nbMessage.Visible = true; ShowResetPassword(); } } else { ShowCode(); } }