如何在asp.net mvc中

时间:2017-04-09 14:19:11

标签: c# asp.net-mvc authentication

我有一个主用户,用户名和密码。我还有其他用户也有用户名和密码。

但现在我希望其他用户只需输入用户名,然后他们就会登录。

但问题是方法:

 public virtual IShopAccount GetShopAccount(Guid shopAccountId, bool validOnly);

只有一个get方法。

因为这种方法来自:

  var salesAgent = CommerceFramework.ShopAccounts.GetShopAccount(Guid.Parse("FED35C7D-7F54-4DD8-9735-EFDFE7E8A738"), true);

ShopAccounts看起来像这样:

  public static ExtendedShopAccountManager ShopAccounts
        {
            get { return (ExtendedShopAccountManager)CommerceFrameworkBase.ShopAccounts; }
        }

那么有没有办法用set方法扩展这个方法?

或者如何更改它,只需用户名即可从用户更改为用户?

谢谢

ProfileController有这个方法:

 [HttpPost]

        public virtual ActionResult Login(LoginModel model);

模型看起来像这样:

public class LoginModel
    {
        public LoginModel();

        //
        // Summary:
        //     /// Gets or sets the password. ///
        [AllowHtml]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        [Required(ErrorMessageResourceName = "Validation_RequiredField")]
        [StringLength(30, ErrorMessageResourceName = "Validation_MaxLengthExceeded")]
        public virtual System.String Password { get; set; }
        //
        // Summary:
        //     /// Gets or sets a value indicating whether to remember the user to login him
        //     automatically on the next visit. ///
        [Display(Name = "Login_RememberMe")]
        public virtual System.Boolean RememberMe { get; set; }
        //
        // Summary:
        //     /// Gets or sets the username. ///
        [DataType(DataType.EmailAddress, ErrorMessageResourceName = "Validation_InvalidField")]
        [Display(Name = "EmailAddress")]
        [Required(ErrorMessageResourceName = "Validation_RequiredField")]
        [StringLength(80, ErrorMessageResourceName = "Validation_MaxLengthExceeded")]
        [TrimAttribute(new[] { })]
        public virtual System.String UserName { get; set; }
    }

0 个答案:

没有答案