开发者

Email edit prevent duplicates

I'm using the built in authentication in my app and have it set up so a Manager role can create n开发者_Go百科ew accounts, assigning a Username and Email. I have edited the RegisterModel inner class of AccountModels to add the regex to ensure an email is a valid email and all works well.

However, when it comes to editing an existing Users Email, I run into trouble. How do I validate that the new email is a valid email? And that another user does not already have this email? I know how to do the regex but where does it go? And I could add a remote call to check for duplicates but again where do I put this stuff? It seems wrong to be checking for duplicates in the controller.

Thanks for your time,

Jay


Try this:

<membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" 
             type="System.Web.Security.SqlMembershipProvider" 
             ... 
             requiresUniqueEmail="true"
             ... />
      </providers>
    </membership>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜