Exemplo n.º 1
0
        public bool sendPasswordLink(string username)
        {
            Majorsilence.Vpn.Poco.Users user = RetrieveUser(username, "");
            string ressetCode = generateCode.GeneratePasswordResetCode(username);

            user.PasswordResetCode = ressetCode;
            using (var db = InitializeSettings.DbFactory)
            {
                db.Open();
                using (var txn = db.BeginTransaction())
                {
                    db.Update(user);

                    txn.Commit();
                }
            }

            email.SendMail(string.Format("Your Email Reset Code is: <a href=\"https://majorsilencevpn.com/validatecode?resetcode={0}\">{1}</a>",
                                         System.Web.HttpUtility.UrlEncode(ressetCode), ressetCode),
                           "Password Reset", username, true, null, Majorsilence.Vpn.Logic.Email.EmailTemplates.Generic);
            return(true);
        }
Exemplo n.º 2
0
        private string GenerateToken()
        {
            var codes = new Helpers.GenerateResetCode();

            return(codes.GeneratePasswordResetCode(DateTime.Now.ToLongTimeString(), 100));
        }