Пример #1
0
 public WebSocketApi(string uri)
 {
     _client        = new Client(uri);
     _login         = new Login(_client);
     _changePwd     = new ChangePwd(_client);
     _forgotPwd     = new ForgotPwd(_client);
     _resetPwd      = new ResetPwd(_client);
     _validMail     = new ValidMail(_client);
     _register      = new Register(_client);
     _getFriends    = new GetFriends(_client);
     _getPFriends   = new GetPendingFriends(_client);
     _removeFriend  = new RemoveFriend(_client);
     _addFriend     = new AddFriend(_client);
     _confirmFriend = new ConfirmFriend(_client);
 }
Пример #2
0
        public WebSocketApi(string uri)
        {
            _client = new Client(uri);
            var dataExchange = new DataExchange(_client);

            _login         = new Login(dataExchange);
            _changePwd     = new ChangePwd(dataExchange);
            _forgotPwd     = new ForgotPwd(dataExchange);
            _resetPwd      = new ResetPwd(dataExchange);
            _validMail     = new ValidMail(dataExchange);
            _register      = new Register(dataExchange);
            _getFriends    = new GetFriends(dataExchange);
            _getPFriends   = new GetPendingFriends(dataExchange);
            _removeFriend  = new RemoveFriend(dataExchange);
            _addFriend     = new AddFriend(dataExchange);
            _confirmFriend = new ConfirmFriend(dataExchange);
            _logger        = LoggerFactory.GetLogger();
        }
Пример #3
0
        public IActionResult ForgotPwd(ForgotPwd forgotPwd)
        {
            string    email  = forgotPwd.Email.ToString();
            string    select = "SELECT * FROM Users WHERE Email='{0}'";
            DataTable dt     = DBUtl.GetTable(select, email);

            foreach (DataRow row in dt.Rows)
            {
                string fname = row.Field <string>("FullName");
                string Email = row.Field <string>("Email");

                string template = @"Hi {0}, <br></br>
                                  We received a request to reset your password for your Accelerator Account. We're here to help!<br></br>
                                   Simply click on the button to set a new password:<br></br>
                                   <button><a href='" + Url.Action("ResetPassword", "Account", new { un = fname }, "http") + "'>Set a New Password</a></button><br></br>" +
                                  "If you didn't ask to change your password, don't worry! Your password is still safe and you can delete this email.<br></br>" +
                                  "Cheers,<br></br>" +
                                  "<i>Accelerator</i>";
                string title   = "Reset Password";
                string message = String.Format(template, fname);
                string result;

                if (EmailUtl.SendEmail(email, title, message, out result))
                {
                    ViewData["Message"] = "Email Successfully Sent";
                    ViewData["MsgType"] = "success";
                }
                else
                {
                    ViewData["Message"] = result;
                    ViewData["MsgType"] = "warning";
                }

                return(View("ForgotPwdCfm"));
            }

            //Create necessary database to store user info if required
            // To code for forgot password to send user email for the password reset link //


            return(View()); //TO remove or edit this line of code//
        }
Пример #4
0
    public static ForgotPwd SendResetEmail(string UserEmail, string UserName)
    {
        string strSubject = System.Configuration.ConfigurationManager.AppSettings["MailSubject"];

        string encrypted = Encryption.Encrypt(String.Format("{0}&{1}", UserName, DateTime.Now.AddMinutes(50000).Ticks), "OMS");

        string BaseUrl = GetBaseUrl();
        var passwordLink = BaseUrl + "Account/ResetPassword?OMS=" + HttpUtility.UrlEncode(encrypted);
        string strBody = "<p>A request has been recieved to reset your password. If you did not initiate the request, then please ignore this email.</p>";
        strBody += "<p>Please click the following link to reset your password: <a href='" + passwordLink + "'>" + passwordLink + "</a></p>";

        bool hasEmailSent = Email.sendemail(UserEmail, "", strBody, true, false, strSubject);

        ForgotPwd ForgotPwd = new ForgotPwd();
        ForgotPwd.UserID = UserEmail;
        ForgotPwd.ResetURL = encrypted;
        ForgotPwd.Isused = false;
        ForgotPwd.createddate = System.DateTime.Now;

        try
        {
            return ForgotPwd;
            // smtpClient.Send(email);
        }
        catch (Exception ex)
        {
            return new ForgotPwd();
            // ErrorHandler.HandleError(ex, ErrorHandler.Level.Error);
        }
    }