コード例 #1
0
ファイル: Membership.cs プロジェクト: fizikci/DomainMarketing
        public bool ChangeMemberPassword(ReqChangeMemberPassword req)
        {
            if ((req.NewPassword ?? "").Length < 6)
            {
                throw new APIException("Password length cannot be less than six", ErrorTypes.ValidationError);
            }
            if (req.NewPassword != req.NewPasswordAgain)
            {
                throw new APIException("Passwords not match", ErrorTypes.ValidationError);
            }

            var member = Session.Member();

            if (member == null)
            {
                throw new APIException("No such member", ErrorTypes.ValidationError);
            }

            try
            {
                member.Password = System.Utility.MD5(req.NewPassword);

                if (member.State == MemberStates.ConfirmedWithFacebook)
                {
                    // bu state sayesinde facebook ile gelen üyenin şifresinin alınmasını sağlıyoruz. Alındığını belirtmek için state'i Confirmed yapıyoruz.
                    member.State = MemberStates.Confirmed;
                }

                member.Save();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #2
0
 public bool ChangeMemberPassword(ReqChangeMemberPassword req)
 {
     return(Call <bool, ReqChangeMemberPassword>(req, MethodBase.GetCurrentMethod().Name));
 }