Comments (5)
Hmm. The MembershipProvider (MS design) has an event (OnValidatingPassword) which can return an exception which should be thrown. So to follow that I also throw an exception when my password strategy validation fails.
It's used both in the CreateUser and ResetPassword methods. But since there is a status code for it, I should maybe catch the exception internally and return the status code instead (in CreateUser). Would be interesting to know how the SqlMembershipProvider does.
from griffin.mvccontrib.
Not sure what the best strategy is. The default implementation of the AccountController in MVC looks like this, so there is no catching an exception. I suppose adding try..catch would work just as well, though:
// Attempt to register the user
MembershipCreateStatus createStatus;
Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);
if (createStatus == MembershipCreateStatus.Success)
{
FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", ErrorCodeToString(createStatus));
}
from griffin.mvccontrib.
The novell SqlProvider both throws exceptions and returns the invalid code. I changed so that CreateUser will always return the invalid code, while ResetPassword can still throw exceptions. Will commit soon.
from griffin.mvccontrib.
I've updated nuget now
On Fri, Aug 17, 2012 at 2:29 PM, Trevor de Koekkoek <
[email protected]> wrote:
Not sure what the best strategy is. The default implementation of the
AccountController in MVC looks like this, so there is no catching an
exception. I suppose adding try..catch would work just as well, though:// Attempt to register the user MembershipCreateStatus createStatus; Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); if (createStatus == MembershipCreateStatus.Success) { FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", ErrorCodeToString(createStatus)); }
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-7816494.
from griffin.mvccontrib.
Thanks. Great project by the way! I'll have to dig into the other contrib
projects and see what they offer.
-Trevor
On Fri, Aug 17, 2012 at 8:54 AM, Jonas Gauffin [email protected]:
I've updated nuget now
On Fri, Aug 17, 2012 at 2:29 PM, Trevor de Koekkoek <
[email protected]> wrote:Not sure what the best strategy is. The default implementation of the
AccountController in MVC looks like this, so there is no catching an
exception. I suppose adding try..catch would work just as well, though:// Attempt to register the user
MembershipCreateStatus createStatus;Membership.CreateUser(model.UserName, model.Password, model.Email, null,
null, true, null, out createStatus);if (createStatus == MembershipCreateStatus.Success)
{
FormsAuthentication.SetAuthCookie(model.UserName, false /*
createPersistentCookie */);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", ErrorCodeToString(createStatus));
}—
Reply to this email directly or view it on GitHub<
https://github.com/jgauffin/griffin.mvccontrib/issues/20#issuecomment-7816494>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-7817005.
Trevor de Koekkoek
http://sincere.ly/tdekoekkoek
from griffin.mvccontrib.
Related Issues (20)
- LocalizedModelValidatorProvider does not contain a constructor that takes 1 arguments HOT 6
- Using EmbeddedFileProvider for plugin css/js files HOT 6
- Client validation for custom validation attributes doesn't work HOT 7
- System.Web.Mvc.CompareAttribute not working HOT 1
- RavenDB localization provider setup HOT 12
- Overwritting of texts in RavenDB on site refresh HOT 1
- RemoteAttribute Unobstrusive Text HOT 3
- Admin section - edit, delete icon do not show up HOT 2
- Attribute not recognized (MVC4): System.ComponentModel.DataAnnotations.EmailAddressAttribute : DataTypeAttribute HOT 5
- Problem with select html helper HOT 4
- Error HOT 1
- Caching of the ViewLocalizer HOT 2
- FileLocalizedTypeRepository loads json file for every translation HOT 2
- Localizing text for ModelState.AddModelError()
- data-val-number attribute is missing HOT 1
- Caching of RepositoryStringProvider results
- GriffinCaching : Closed Connection
- Web API support?
- No constructor for LocalizedModelValidatorProvider takes 1 argument
- Pull request for update to MVC5 and AppVeyor HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from griffin.mvccontrib.