示例#1
0
            protected internal override void Verify(AccesscodeContext context, string accesscode)
            {
                AccesscodeController ctxt = context.Owner;

                if (ctxt.IsValid(accesscode))
                {
                    context.State.Exit(context);
                    context.ClearState();

                    try
                    {
                        ctxt.SaveAccesscode();
                    }
                    finally
                    {
                        context.State = AuthMap.Verified;
                        context.State.Entry(context);
                    }
                }
                else if (ctxt.HaveMoreAttempts())
                {
                    context.State.Exit(context);
                    context.ClearState();

                    try
                    {
                        ctxt.IncrementAttempts();
                    }
                    finally
                    {
                        context.State = AuthMap.Unverified;
                        context.State.Entry(context);
                    }
                }
                else
                {
                    context.State.Exit(context);
                    context.State = AuthMap.Denied;
                    context.State.Entry(context);
                }

                return;
            }
示例#2
0
            protected internal override void Authenticate(AccesscodeContext context, string phonenumber)
            {
                AccesscodeController ctxt = context.Owner;


                context.State.Exit(context);
                context.ClearState();

                try
                {
                    ctxt.SMSAccesscode(phonenumber);
                }
                finally
                {
                    context.State = AuthMap.Unverified;
                    context.State.Entry(context);
                }



                return;
            }