コード例 #1
0
ファイル: EntryHandler.cs プロジェクト: liorkatiy/Chat
 //Get Called If The Client Asked To Register
 void Register(Connection <Entry> con, RegisterInfo info)
 {
     if (database.ContainsUser(info.Email)) //check if the user isnt in the data base already
     {
         con.Send(Entry.Register, new VerifyClientRegister("Email Is Already Registered"));
     }
     else
     {
         if (!mailVerificationNeeded)
         {
             con.Send(Entry.Register, new VerifyClientRegister(false));
             database.AddUser(info);
         }
         else
         {
             CodeVerification <int> verifycode;
             if (!mailhandler.SendMail(info.Email, out verifycode))
             {
                 con.Send(Entry.Register, new VerifyClientRegister("Couldn't Send Mail"));
             }
             else
             {
                 con.Send(Entry.Register, new VerifyClientRegister(true));
                 if (verifycode.Verify(con.BaseStream, 75))
                 {
                     database.AddUser(info);
                 }
             }
         }
     }
     con.Close();
 }