Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    MikeRaarupBirk's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    1,583
    Reputation
    38
    Thanks
    3,775
    My Mood
    Stressed

    [FSOD] Forgot Password


    So i was unable to get the one in fsod working, so i made a new one.

    ForgotPassword.cs

    Code:
    #region
    
    using db;
    using System;
    using System.Collections.Specialized;
    using System(DOT)IO;
    using System.Net;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    
    #endregion
    
    namespace server.account
    {
        internal class forgotPassword : RequestHandler
        {
            protected override void HandleRequest()
            {
                using (Database db = new Database())
                {
    
                    //Generates a random password
                    string password = Database.GenerateRandomString(10);
    
                    //Changes the users password
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "UPDATE accounts SET password=SHA1(@password) WHERE uuid=@email;";
                    cmd.Parameters.AddWithValue("@password", password);
                    cmd.Parameters.AddWithValue("@email", Query["guid"]);
    
    
                    if (cmd.ExecuteNonQuery() == 1)
                    {
    
                        //Makes the email sending function
                        SmtpClient client = new SmtpClient();
                        client.Port = 587;
                        client.Host = "smtp.gmail.com";
                        client.EnableSsl = true;
                        client.Timeout = 10000;
                        client.DeliveryMethod = SmtpDeliveryMethod.Network;
                        client.UseDefaultCredentials = false;
                        client.Credentials = new System.Net.NetworkCredential("YOURSERVEREMAIL", "YOURSERVERPASSWORD"); //Email credentials
    
    
    
                        //Email information
                        MailMessage mm = new MailMessage("RANDOMEMAILHERE", Query["guid"], "SERVERNAME", "SERVERNAME");
                        mm.Body = "Your new password for SERVERNAME is: " + password + " hopefully you wont forget your password again.";
                        mm.BodyEncoding = UTF8Encoding.UTF8;
                        mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
    
    
                        //Send the actual email
                        client.Send(mm);
    
                        //Logs the action
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("Reset Password Link sent to " + Query["guid"]);
                        Console.ForegroundColor = ConsoleColor.White;
    
                    }
                    else
                        using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream))
                            wtr.Write("<Error>Error.accountNotFound</Error>");
                }
            }
        }
    }
    I put some words with caps, that you'd have to change to make it work.

    If you are using this, and removed encryption from passwords, you need to remove the SHA1 from this code.

    Also make sure the email you are using, doesnt have any security because if it does, the email wont send.

    Replace (DOT) with "."



    Last edited by MikeRaarupBirk; 12-23-2016 at 03:52 AM.

  2. The Following 4 Users Say Thank You to MikeRaarupBirk For This Useful Post:

    Alde. (12-27-2016),bog624 (02-26-2018),BurgerLoverMx (12-23-2016),Nikolai Belinski (12-26-2016)

  3. #2
    ETHerthethaethaetheh's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    930
    Reputation
    40
    Thanks
    225
    My Mood
    Psychedelic
    With this i can get pretty much anyones password..?

  4. #3
    MikeRaarupBirk's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    1,583
    Reputation
    38
    Thanks
    3,775
    My Mood
    Stressed
    Quote Originally Posted by gusitis00 View Post
    With this i can get pretty much anyones password..?
    Ehm no? But if you used an actual email, that you have access to you can reset your password using this function.


  5. #4
    ETHerthethaethaetheh's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    930
    Reputation
    40
    Thanks
    225
    My Mood
    Psychedelic
    Quote Originally Posted by MikeRaarupBirk View Post
    Ehm no? But if you used an actual email, that you have access to you can reset your password using this function.

    Oh.. aight lol

  6. #5
    BurgerLoverMx's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Location
    Québec
    Posts
    411
    Reputation
    23
    Thanks
    843
    My Mood
    Relaxed
    Quote Originally Posted by MikeRaarupBirk View Post

    So i was unable to get the one in fsod working, so i made a new one.

    ForgotPassword.cs

    Code:
    #region
    
    using db;
    using System;
    using System.Collections.Specialized;
    using System(DOT)IO;
    using System.Net;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    
    #endregion
    
    namespace server.account
    {
        internal class forgotPassword : RequestHandler
        {
            protected override void HandleRequest()
            {
                using (Database db = new Database())
                {
    
                    //Generates a random password
                    string password = Database.GenerateRandomString(10);
    
                    //Changes the users password
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "UPDATE accounts SET password=SHA1(@password) WHERE uuid=@email;";
                    cmd.Parameters.AddWithValue("@password", password);
                    cmd.Parameters.AddWithValue("@email", Query["guid"]);
    
    
                    if (cmd.ExecuteNonQuery() == 1)
                    {
    
                        //Makes the email sending function
                        SmtpClient client = new SmtpClient();
                        client.Port = 587;
                        client.Host = "smtp.gmail.com";
                        client.EnableSsl = true;
                        client.Timeout = 10000;
                        client.DeliveryMethod = SmtpDeliveryMethod.Network;
                        client.UseDefaultCredentials = false;
                        client.Credentials = new System.Net.NetworkCredential("YOURSERVEREMAIL", "YOURSERVERPASSWORD"); //Email credentials
    
    
    
                        //Email information
                        MailMessage mm = new MailMessage("RANDOMEMAILHERE", Query["guid"], "SERVERNAME", "SERVERNAME");
                        mm.Body = "Your new password for SERVERNAME is: " + password + " hopefully you wont forget your password again.";
                        mm.BodyEncoding = UTF8Encoding.UTF8;
                        mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
    
    
                        //Send the actual email
                        client.Send(mm);
    
                        //Logs the action
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("Reset Password Link sent to " + Query["guid"]);
                        Console.ForegroundColor = ConsoleColor.White;
    
                    }
                    else
                        using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream))
                            wtr.Write("<Error>Error.accountNotFound</Error>");
                }
            }
        }
    }
    I put some words with caps, that you'd have to change to make it work.

    If you are using this, and removed encryption from passwords, you need to remove the SHA1 from this code.

    Also make sure the email you are using, doesnt have any security because if it does, the email wont send.

    Replace (DOT) with "."



    Thanks Mike

  7. #6
    New's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Location
    Location:
    Posts
    2,605
    Reputation
    386
    Thanks
    4,708
    My Mood
    Angelic
    Quote Originally Posted by MikeRaarupBirk View Post
    "Forgot your password? We'll email it."
    We'll email it? Like a new random one, or the actual password which is supposed to be hashed?
    New

    Current Project:
    SimpleExaltHack

    Outdated stuff I made in the past:
    Famebot
    Clientless tradebot
    RotMG ping checker
    Zautonexus crack

  8. #7
    einaras's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    642
    Reputation
    22
    Thanks
    1,387
    My Mood
    Fine
    Quote Originally Posted by PKTINOS View Post


    We'll email it? Like a new random one, or the actual password which is supposed to be hashed?
    Quote Originally Posted by MikeRaarupBirk View Post
    its random.

  9. The Following User Says Thank You to einaras For This Useful Post:

    New (12-23-2016)

  10. #8
    New's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Location
    Location:
    Posts
    2,605
    Reputation
    386
    Thanks
    4,708
    My Mood
    Angelic
    Quote Originally Posted by einaras View Post
    its random.
    Damn the pic attracted my attention. Should've read the entire thread.
    New

    Current Project:
    SimpleExaltHack

    Outdated stuff I made in the past:
    Famebot
    Clientless tradebot
    RotMG ping checker
    Zautonexus crack

  11. #9
    BurgerLoverMx's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Location
    Québec
    Posts
    411
    Reputation
    23
    Thanks
    843
    My Mood
    Relaxed
    Problem though, if someone just sends a password reset request for any email, and the owner doesn't know of it, then he gets his password reset even if he didn't want that.

  12. The Following User Says Thank You to BurgerLoverMx For This Useful Post:

    New (12-23-2016)

  13. #10
    MikeRaarupBirk's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    1,583
    Reputation
    38
    Thanks
    3,775
    My Mood
    Stressed
    Quote Originally Posted by BurgerLoverMx View Post
    Problem though, if someone just sends a password reset request for any email, and the owner doesn't know of it, then he gets his password reset even if he didn't want that.
    just dont share email with anyone and ur fine

  14. #11
    ZeusAlmighty's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    689
    Reputation
    27
    Thanks
    2,198
    My Mood
    Buzzed
    Quote Originally Posted by MikeRaarupBirk View Post
    just dont share email with anyone and ur fine
    Thats pretty true, considering people wont know what email you used unless you show them by accident. However if you made a time limiter like 24 hours or something, would be better as people might spam it.

    Nice work though

  15. The Following User Says Thank You to ZeusAlmighty For This Useful Post:

    MikeRaarupBirk (12-25-2016)

  16. #12
    B3CLAWED's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    143
    Reputation
    10
    Thanks
    57
    My Mood
    Busy
    Got a big error: prntscr(dot)com/dnwlu0 please help XD

  17. #13
    MikeRaarupBirk's Avatar
    Join Date
    Mar 2016
    Gender
    male
    Posts
    1,583
    Reputation
    38
    Thanks
    3,775
    My Mood
    Stressed
    Quote Originally Posted by B3CLAWED View Post
    Got a big error: prntscr(dot)com/dnwlu0 please help XD
    Works fine for me, are you sure that the email u put into the code is non-secured? And filled all the "CAPS" words i wrote?

  18. #14
    Nikolai Belinski's Avatar
    Join Date
    Dec 2016
    Gender
    male
    Posts
    128
    Reputation
    17
    Thanks
    41
    Quote Originally Posted by gusitis00 View Post
    With this i can get pretty much anyones password..?
    there is already a tutorial for that....

    - - - Updated - - -

    Quote Originally Posted by MikeRaarupBirk View Post

    So i was unable to get the one in fsod working, so i made a new one.

    ForgotPassword.cs

    Code:
    #region
    
    using db;
    using System;
    using System.Collections.Specialized;
    using System(DOT)IO;
    using System.Net;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    
    #endregion
    
    namespace server.account
    {
        internal class forgotPassword : RequestHandler
        {
            protected override void HandleRequest()
            {
                using (Database db = new Database())
                {
    
                    //Generates a random password
                    string password = Database.GenerateRandomString(10);
    
                    //Changes the users password
                    var cmd = db.CreateQuery();
                    cmd.CommandText = "UPDATE accounts SET password=SHA1(@password) WHERE uuid=@email;";
                    cmd.Parameters.AddWithValue("@password", password);
                    cmd.Parameters.AddWithValue("@email", Query["guid"]);
    
    
                    if (cmd.ExecuteNonQuery() == 1)
                    {
    
                        //Makes the email sending function
                        SmtpClient client = new SmtpClient();
                        client.Port = 587;
                        client.Host = "smtp.gmail.com";
                        client.EnableSsl = true;
                        client.Timeout = 10000;
                        client.DeliveryMethod = SmtpDeliveryMethod.Network;
                        client.UseDefaultCredentials = false;
                        client.Credentials = new System.Net.NetworkCredential("YOURSERVEREMAIL", "YOURSERVERPASSWORD"); //Email credentials
    
    
    
                        //Email information
                        MailMessage mm = new MailMessage("RANDOMEMAILHERE", Query["guid"], "SERVERNAME", "SERVERNAME");
                        mm.Body = "Your new password for SERVERNAME is: " + password + " hopefully you wont forget your password again.";
                        mm.BodyEncoding = UTF8Encoding.UTF8;
                        mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
    
    
                        //Send the actual email
                        client.Send(mm);
    
                        //Logs the action
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("Reset Password Link sent to " + Query["guid"]);
                        Console.ForegroundColor = ConsoleColor.White;
    
                    }
                    else
                        using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream))
                            wtr.Write("<Error>Error.accountNotFound</Error>");
                }
            }
        }
    }
    I put some words with caps, that you'd have to change to make it work.

    If you are using this, and removed encryption from passwords, you need to remove the SHA1 from this code.

    Also make sure the email you are using, doesnt have any security because if it does, the email wont send.

    Replace (DOT) with "."



    This fix is pretty neat. +1
    As child i scavenged for food. Not because i was hungry, but because i was greedy.

  19. The Following User Says Thank You to Nikolai Belinski For This Useful Post:

    MikeRaarupBirk (12-26-2016)

  20. #15
    B3CLAWED's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    143
    Reputation
    10
    Thanks
    57
    My Mood
    Busy
    Quote Originally Posted by MikeRaarupBirk View Post
    Works fine for me, are you sure that the email u put into the code is non-secured? And filled all the "CAPS" words i wrote?
    What do you mean by non-secured? Because I didn't put a phone number or backup email

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help Request] forgot password+email
    By modorbye in forum Minecraft Help
    Replies: 2
    Last Post: 01-16-2014, 10:57 AM
  2. [Help Request] forgot password plz help
    By goodboys in forum CrossFire Help
    Replies: 3
    Last Post: 06-09-2013, 10:18 PM
  3. forgot password
    By goodboys in forum CrossFire Help
    Replies: 4
    Last Post: 05-19-2013, 11:42 AM
  4. forgot password
    By goodboys in forum CrossFire Help
    Replies: 1
    Last Post: 05-15-2013, 01:03 PM
  5. Forgot password, and now?
    By wilco10 in forum WarRock Korea Hacks
    Replies: 1
    Last Post: 02-05-2010, 02:32 AM