Пример #1
0
 private void GeneratePassword(User user)
 {
     var randomPassword = GetRandomPassword();
     user.Password = randomPassword;
     SetHashedPassword(user);
     user.PasswordExpiryTime = DateTime.UtcNow.AddHours(2);
     user.IsTemporary = true;
     Context.Users.Save(user);
     EmailHelper.Send("Password Recovery", string.Format("Your new password is {0}", randomPassword), user.EmailAddress);
 }
Пример #2
0
 private void SendNotification(Feeling feeling, Comment comment, List<User> users, User feelingUser)
 {
     try
     {
         new PushNotificationService().SendCommentNotifications(feeling, comment, users, SaveResponse, feelingUser);
     }
     catch (Exception e)
     {
         LogWriter.Write(e.ToString());
     }
 }
        public void SendCommentNotifications(Feeling feeling, Comment comment, List<User> users, Action<string> action, User feelingUser)
        {
            _action = action;


            SendNotifications(comment.User, new List<User> { feelingUser },
                string.Format("Comment '{0}' on feeling: '{1}' from ", comment.Text, feeling.FeelingText), feeling);

            SendNotifications(comment.User, users, string.Format("Comment '{0}' on comment", comment.Text), feeling);

        }
Пример #4
0
 private User GetDbUser(User user)
 {
     return Context.Users.FindOne(Query<User>.EQ(u => u.UserNameLower, user.UserName.ToLower()));
 }
Пример #5
0
 private static void SetHashedPassword(User user, string password = "")
 {
     var hashedPassword = PasswordHash.CreateHash(string.IsNullOrEmpty(password) ? user.Password : password).Split(':');
     user.PasswordSalt = hashedPassword[2];
     user.Password = hashedPassword[3];
 }