コード例 #1
0
        public static void SendEmailForConfirmation(Users u, DataContext db)
        {
            string code = GenerateString();

            Confirmations c = new Confirmations()
            {
                Email  = u.Email,
                UserId = u.UserID,
                Type   = ConfirmType.EmailConfirm,
                Code   = HttpUtility.UrlDecode(code),
                Expiry = DateTime.Now.AddMinutes(30d)
            };

            db.Confirmations.Add(c);

            string addr = HttpUtility.UrlEncode(u.Email);

            string link = string.Format("https://haxnet.azurewebsites.net/Auth/ConfirmEmail?Email={0}&Code={1}", addr, code);

            using (MailClient mc = new MailClient(u.Email))
            {
                mc.Subject = "HackNet - Verify your Email Address";
                mc.AddLine("");
                mc.AddLine("Kindly verify your email address by clicking on the link below");
                mc.AddLine("This link will expire in 30 minutes");
                mc.AddLine("If that does not work, please use this code: " + code);
                mc.Send(u.FullName, "Verify Email", link);
            }
            db.SaveChanges();
        }
コード例 #2
0
        public static void SendEmailForPasswordReset(string email)
        {
            using (DataContext db = new DataContext())
                using (Authenticate a = new Authenticate(email))
                {
                    string        code = GenerateString();
                    Confirmations c    = new Confirmations()
                    {
                        Email  = a.Email,
                        UserId = a.UserId,
                        Type   = ConfirmType.PasswordReset,
                        Code   = HttpUtility.UrlDecode(code),               // no need to encode for db
                        Expiry = DateTime.Now.AddMinutes(30d)
                    };
                    db.Confirmations.Add(c);

                    string addr = HttpUtility.UrlEncode(a.Email);

                    string link = string.Format("https://haxnet.azurewebsites.net/Auth/ResetPassword?Email={0}&Code={1}", addr, code);
                    link = HttpUtility.HtmlAttributeEncode(link);             // Encoding for QueryString

                    using (MailClient mc = new MailClient(a.Email))
                    {
                        mc.Subject = "Password Reset Request";
                        mc.AddLine("");
                        mc.AddLine("You have initiated a password reset request!");
                        mc.AddLine("If it was you, please click the link below to continue");
                        mc.AddLine("Otherwise, you can safely ignore this message as it will expire in 30 minutes");
                        mc.Send("user", "Reset Password", link);
                    }
                    db.SaveChanges();
                }
        }
コード例 #3
0
ファイル: Messagebox.cs プロジェクト: ralfw/ShellForms
		public Messagebox(string title, IEnumerable<string> message, 
						  ConfirmationButtons confirmationbuttons = ConfirmationButtons.Ok) {
			this.owner = new ShellForms ();

			this.Title = title;

			message = message.SelectMany (l => l.Split (new[]{'\n'}));

			var messageWidth = message.Max (l => l.Length);
			var width = messageWidth + 4;
			var height = message.Count() + 4;
			var left = Console.WindowWidth / 2 - width / 2;
			var top = Console.WindowHeight / 2 - height / 2;

			var lblFrame = new Label (left, top);
			lblFrame.Text = "+" + new string('-', width-2) + "+";
			for (var i = 1; i < height; i++)
				lblFrame.Text += "\n" + "|" + new string(' ', width-2) + "|";
			lblFrame.Text += "\n" + "+" + new string('-', width-2) + "+";
			base.Add (lblFrame);

			var lblMsg = new Label (left + 2, top + 2);
			lblMsg.Text = string.Join ("\n", message);
			base.Add (lblMsg);


			if (confirmationbuttons == ConfirmationButtons.Ok) {
				var btnOk = new Button (left + width / 2 - 2, top + height - 1, "Ok");
				base.Add (btnOk);

				btnOk.OnPressed += _ => {
					this.confirmation = Confirmations.Ok;
					this.owner.Stop ();
				};
			} else {
				var btnOk = new Button (left + width / 2 - 7, top + height - 1, "Ok");
				base.Add (btnOk);

				btnOk.OnPressed += _ => {
					this.confirmation = Confirmations.Ok;
					this.owner.Stop ();
				};

				var btnCancel = new Button (left + width / 2 - 2, top + height - 1, "Cancel");
				base.Add (btnCancel);

				btnCancel.OnPressed += _ => {
					this.confirmation = Confirmations.Cancel;
					this.owner.Stop ();
				};
			}

			owner.Push (this);
		}
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (From != null ? From.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Timestamp != null ? Timestamp.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Nonce.GetHashCode();
         hashCode = (hashCode * 397) ^ Confirmations.GetHashCode();
         hashCode = (hashCode * 397) ^ Block.GetHashCode();
         hashCode = (hashCode * 397) ^ (GasPrice != null ? GasPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (GasUsed != null ? GasUsed.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #5
0
ファイル: Notification.cs プロジェクト: ruzanowski/Ubiquitous
        public void ChangeStateToHidden(Guid userId)
        {
            var isReadAlready = Confirmations.Any(x =>
                                                  x.User.Equals(userId) && x.ConfirmationType == ConfirmationType.Read);

            if (isReadAlready)
            {
                return;
            }

            var confirmation = new Confirmation(userId,
                                                Id,
                                                ConfirmationType.Hidden,
                                                Guid.Empty); //todo: device Received

            Confirmations.Add(confirmation);
        }
コード例 #6
0
ファイル: Monitee.cs プロジェクト: dansam100/FolderMonitor
 internal void RemoveDestination(string destName)
 {
     for (int i = 0; i < Index; i++)
     {
         if (destination[i] == destName)
         {
             if (Destinations.Length.CompareTo(1) == 0)
             {
                 if (Confirmations.Confirm("removemonitee") == DialogResult.No)
                 {
                     return;
                 }
             }
             --Index;
             destination[i] = destination[Index];
             break;
         }
     }
 }
コード例 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (TransactionId != null ? TransactionId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Hash != null ? Hash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Size.GetHashCode();
         hashCode = (hashCode * 397) ^ Vsize.GetHashCode();
         hashCode = (hashCode * 397) ^ Version.GetHashCode();
         hashCode = (hashCode * 397) ^ LockTime.GetHashCode();
         hashCode = (hashCode * 397) ^ (Blockhash != null ? Blockhash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ BlockNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ Confirmations.GetHashCode();
         hashCode = (hashCode * 397) ^ (Time != null ? Time.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VIn != null ? VIn.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VOut != null ? VOut.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Chain != null ? Chain.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TokenTransfers != null ? TokenTransfers.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Index;
         hashCode = (hashCode * 397) ^ (TransactionHash != null ? TransactionHash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Value.GetHashCode();
         hashCode = (hashCode * 397) ^ (FromAddress != null ? FromAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ToAddress != null ? ToAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Date != null ? Date.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BlockHash != null ? BlockHash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ BlockNumber.GetHashCode();
         hashCode = (hashCode * 397) ^ Gas.GetHashCode();
         hashCode = (hashCode * 397) ^ GasPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ GasUsed.GetHashCode();
         hashCode = (hashCode * 397) ^ Nonce.GetHashCode();
         hashCode = (hashCode * 397) ^ Confirmations.GetHashCode();
         hashCode = (hashCode * 397) ^ (Input != null ? Input.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #9
0
 public Task ConfirmApprenticeship(Guid apprenticeId, long apprenticeshipId, long revisionId, [FromBody] Confirmations confirmations)
 => _client.Patch($"apprentices/{apprenticeId}/apprenticeships/{apprenticeshipId}/revisions/{revisionId}/confirmations", confirmations);
コード例 #10
0
ファイル: Batch.cs プロジェクト: war-man/booking
 public Confirmation GetConfirmation(string apartmentCode) => Confirmations != null?Confirmations.FirstOrDefault(e => e.LocalCode == apartmentCode) : null;
コード例 #11
0
ファイル: Batch.cs プロジェクト: war-man/booking
 public bool ContainConfirmation(string apartmentCode) => Confirmations != null?Confirmations.FirstOrDefault(e => e.LocalCode == apartmentCode) != null : false;
コード例 #12
0
        public Messagebox(string title, IEnumerable <string> message,
                          ConfirmationButtons confirmationbuttons = ConfirmationButtons.Ok)
        {
            this.owner = new ShellForms();

            this.Title = title;

            message = message.SelectMany(l => l.Split(new[] { '\n' }));

            var messageWidth = message.Max(l => l.Length);
            var width        = messageWidth + 4;
            var height       = message.Count() + 4;
            var left         = Console.WindowWidth / 2 - width / 2;
            var top          = Console.WindowHeight / 2 - height / 2;

            var lblFrame = new Label(left, top);

            lblFrame.Text = "+" + new string('-', width - 2) + "+";
            for (var i = 1; i < height; i++)
            {
                lblFrame.Text += "\n" + "|" + new string(' ', width - 2) + "|";
            }
            lblFrame.Text += "\n" + "+" + new string('-', width - 2) + "+";
            base.Add(lblFrame);

            var lblMsg = new Label(left + 2, top + 2);

            lblMsg.Text = string.Join("\n", message);
            base.Add(lblMsg);


            if (confirmationbuttons == ConfirmationButtons.Ok)
            {
                var btnOk = new Button(left + width / 2 - 2, top + height - 1, "Ok");
                base.Add(btnOk);

                btnOk.OnPressed += _ => {
                    this.confirmation = Confirmations.Ok;
                    this.owner.Stop();
                };
            }
            else
            {
                var btnOk = new Button(left + width / 2 - 7, top + height - 1, "Ok");
                base.Add(btnOk);

                btnOk.OnPressed += _ => {
                    this.confirmation = Confirmations.Ok;
                    this.owner.Stop();
                };

                var btnCancel = new Button(left + width / 2 - 2, top + height - 1, "Cancel");
                base.Add(btnCancel);

                btnCancel.OnPressed += _ => {
                    this.confirmation = Confirmations.Cancel;
                    this.owner.Stop();
                };
            }

            owner.Push(this);
        }