Devin Martin avatar Devin Martin committed 1ec28c5

Add some troubleshooting helpers.

Comments (0)

Files changed (7)

       <DependentUpon>ShowOneTimePasswords.cs</DependentUpon>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Troubleshooting.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Troubleshooting.Designer.cs">
+      <DependentUpon>Troubleshooting.cs</DependentUpon>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
     <EmbeddedResource Include="ShowOneTimePasswords.resx">
       <DependentUpon>ShowOneTimePasswords.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Troubleshooting.resx">
+      <DependentUpon>Troubleshooting.cs</DependentUpon>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="OtpSharp\OtpSharp\OtpSharp.csproj">

ShowOneTimePasswords.Designer.cs

             this.labelInstructions = new System.Windows.Forms.Label();
             this.buttonClose = new System.Windows.Forms.Button();
             this.buttonEdit = new System.Windows.Forms.Button();
+            this.buttonIncorrect = new System.Windows.Forms.Button();
             this.SuspendLayout();
             // 
             // labelOtp
             // 
             this.labelOtp.AutoSize = true;
             this.labelOtp.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.labelOtp.Location = new System.Drawing.Point(24, 93);
+            this.labelOtp.Location = new System.Drawing.Point(24, 36);
             this.labelOtp.Name = "labelOtp";
             this.labelOtp.Size = new System.Drawing.Size(224, 73);
             this.labelOtp.TabIndex = 0;
             // labelRemaining
             // 
             this.labelRemaining.AutoSize = true;
-            this.labelRemaining.Location = new System.Drawing.Point(145, 166);
+            this.labelRemaining.Location = new System.Drawing.Point(145, 109);
             this.labelRemaining.Name = "labelRemaining";
             this.labelRemaining.Size = new System.Drawing.Size(12, 13);
             this.labelRemaining.TabIndex = 1;
             // labelRemainingLabel
             // 
             this.labelRemainingLabel.AutoSize = true;
-            this.labelRemainingLabel.Location = new System.Drawing.Point(53, 166);
+            this.labelRemainingLabel.Location = new System.Drawing.Point(53, 109);
             this.labelRemainingLabel.Name = "labelRemainingLabel";
             this.labelRemainingLabel.Size = new System.Drawing.Size(86, 13);
             this.labelRemainingLabel.TabIndex = 2;
             | System.Windows.Forms.AnchorStyles.Right)));
             this.labelInstructions.Location = new System.Drawing.Point(12, 9);
             this.labelInstructions.Name = "labelInstructions";
-            this.labelInstructions.Size = new System.Drawing.Size(304, 69);
+            this.labelInstructions.Size = new System.Drawing.Size(304, 35);
             this.labelInstructions.TabIndex = 3;
-            this.labelInstructions.Text = "Enter this code in the verification system.  If problems occur contunually double" +
-    " check that the clock on your computer is set precisely.  Be sure to double chec" +
-    "k the time zone as well.";
+            this.labelInstructions.Text = "Enter this code in the verification system.";
             // 
             // buttonClose
             // 
             this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.OK;
-            this.buttonClose.Location = new System.Drawing.Point(241, 231);
+            this.buttonClose.Location = new System.Drawing.Point(241, 160);
             this.buttonClose.Name = "buttonClose";
             this.buttonClose.Size = new System.Drawing.Size(75, 23);
             this.buttonClose.TabIndex = 4;
             // buttonEdit
             // 
             this.buttonEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.buttonEdit.Location = new System.Drawing.Point(160, 231);
+            this.buttonEdit.Location = new System.Drawing.Point(160, 160);
             this.buttonEdit.Name = "buttonEdit";
             this.buttonEdit.Size = new System.Drawing.Size(75, 23);
             this.buttonEdit.TabIndex = 5;
             this.buttonEdit.UseVisualStyleBackColor = true;
             this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
             // 
+            // buttonIncorrect
+            // 
+            this.buttonIncorrect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+            this.buttonIncorrect.Location = new System.Drawing.Point(15, 160);
+            this.buttonIncorrect.Name = "buttonIncorrect";
+            this.buttonIncorrect.Size = new System.Drawing.Size(124, 23);
+            this.buttonIncorrect.TabIndex = 6;
+            this.buttonIncorrect.Text = "Not the correct code?";
+            this.buttonIncorrect.UseVisualStyleBackColor = true;
+            this.buttonIncorrect.Click += new System.EventHandler(this.buttonIncorrect_Click);
+            // 
             // ShowOneTimePasswords
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(328, 266);
+            this.ClientSize = new System.Drawing.Size(328, 198);
+            this.Controls.Add(this.buttonIncorrect);
             this.Controls.Add(this.buttonEdit);
             this.Controls.Add(this.buttonClose);
             this.Controls.Add(this.labelInstructions);
         private System.Windows.Forms.Label labelInstructions;
         private System.Windows.Forms.Button buttonClose;
         private System.Windows.Forms.Button buttonEdit;
+        private System.Windows.Forms.Button buttonIncorrect;
     }
 }

ShowOneTimePasswords.cs

             else
                 this.ShowCode();
         }
+
+        private void buttonIncorrect_Click(object sender, EventArgs e)
+        {
+            Troubleshooting troubleshooting = new Troubleshooting();
+            troubleshooting.ShowDialog();
+        }
     }
 }

ShowOneTimePasswords.resx

     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="timerUpdateTotp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="timerUpdateTotp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
 </root>

Troubleshooting.Designer.cs

+namespace KeeOtp
+{
+    partial class Troubleshooting
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.labelHeader = new System.Windows.Forms.Label();
+            this.buttonPingGoogle = new System.Windows.Forms.Button();
+            this.buttonTroubleshootingWebsite = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // labelHeader
+            // 
+            this.labelHeader.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.labelHeader.Location = new System.Drawing.Point(13, 13);
+            this.labelHeader.MaximumSize = new System.Drawing.Size(350, 48);
+            this.labelHeader.Name = "labelHeader";
+            this.labelHeader.Size = new System.Drawing.Size(341, 48);
+            this.labelHeader.TabIndex = 0;
+            this.labelHeader.Text = "There are many things that can cause an incorrect code.  We\'ll go through the mos" +
+    "t common things here.";
+            // 
+            // buttonPingGoogle
+            // 
+            this.buttonPingGoogle.Location = new System.Drawing.Point(16, 55);
+            this.buttonPingGoogle.Name = "buttonPingGoogle";
+            this.buttonPingGoogle.Size = new System.Drawing.Size(338, 23);
+            this.buttonPingGoogle.TabIndex = 1;
+            this.buttonPingGoogle.Text = "Ping Google for current time";
+            this.buttonPingGoogle.UseVisualStyleBackColor = true;
+            this.buttonPingGoogle.Click += new System.EventHandler(this.buttonPingGoogle_Click);
+            // 
+            // buttonTroubleshootingWebsite
+            // 
+            this.buttonTroubleshootingWebsite.Location = new System.Drawing.Point(16, 85);
+            this.buttonTroubleshootingWebsite.Name = "buttonTroubleshootingWebsite";
+            this.buttonTroubleshootingWebsite.Size = new System.Drawing.Size(338, 23);
+            this.buttonTroubleshootingWebsite.TabIndex = 2;
+            this.buttonTroubleshootingWebsite.Text = "Check the troubleshooting website";
+            this.buttonTroubleshootingWebsite.UseVisualStyleBackColor = true;
+            this.buttonTroubleshootingWebsite.Click += new System.EventHandler(this.buttonTroubleshootingWebsite_Click);
+            // 
+            // Troubleshooting
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(366, 129);
+            this.Controls.Add(this.buttonTroubleshootingWebsite);
+            this.Controls.Add(this.buttonPingGoogle);
+            this.Controls.Add(this.labelHeader);
+            this.MinimumSize = new System.Drawing.Size(350, 48);
+            this.Name = "Troubleshooting";
+            this.Text = "Troubleshooting";
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label labelHeader;
+        private System.Windows.Forms.Button buttonPingGoogle;
+        private System.Windows.Forms.Button buttonTroubleshootingWebsite;
+    }
+}

Troubleshooting.cs

+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Windows.Forms;
+
+namespace KeeOtp
+{
+    public partial class Troubleshooting : Form
+    {
+        public Troubleshooting()
+        {
+            InitializeComponent();
+        }
+
+        private void buttonPingGoogle_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                using (var wc = new WebClient())
+                {
+                    wc.DownloadData("https://www.google.com");
+                    var dateHeader = wc.ResponseHeaders.Get("Date");
+                    var date = DateTime.Parse(dateHeader);
+
+                    var offset = date.ToUniversalTime() - DateTime.UtcNow;
+
+                    if (offset.TotalSeconds == 0)
+                        MessageBox.Show("Your time is perfect according to Google's servers");
+                    else if (offset.TotalSeconds <= 5)
+                        MessageBox.Show("Your time is off by five seconds or less from Google's servers.  You should be just fine.");
+                    else
+                        MessageBox.Show(string.Format("Your time is off by {0} seconds from Google's servers.  Try correcting the difference and try again.", offset.TotalSeconds));
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message, "Error");
+            }
+        }
+
+        private void buttonTroubleshootingWebsite_Click(object sender, EventArgs e)
+        {
+            // go to the troubleshooting page
+            var url = "https://bitbucket.org/devinmartin/keeotp/wiki/Troubleshooting";
+            Process ps = new Process();
+            ps.StartInfo = new ProcessStartInfo(url);
+            ps.Start();
+        }
+    }
+}

Troubleshooting.resx

+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.