Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to manage users (register a new user, restore a password, etc.) from the logon form in ASP.NET

$
0
0

Scenario
This example contains a reusable Security.Extensions module that provides a possible solution for the following scenarios:

Security - provide the capability to register a new user from the logon form
Security.Authentication - provide a "Forgot Password" feature

Refer to the following video to see the module features in action: http://www.screencast.com/t/h2goGEdZJc

Steps to implement

In order to use this module in your project, do the following:

1. Download and include the Security.Extensions module project into your XAF solution (as per MSDN) and rebuild it. This custom module contains Application Model settings (Model.DesignedDiffs.xafml) to layout custom Actions next to the logon form input fields (see the How to: Include an Action to a Detail View Layout  article for more details) as well as non-persistent data models for parameter screens (LogonActionParameters.cs) and finally a ViewController (ManageUsersOnLogonController.cs) for the logon DetailView that declares custom Actions and their behavior. The controller is registered via the XafApplication.CreateCustomLogonWindowControllers event in the ModuleBase descendant (Module.cs) along with other service logic.

2. Invoke the Module Designer for your platform-agnostic module and drag and drop the SecurityExtensionsModule from the Toolbox;

3. Add the following code into your platform-agnostic module class:

[C#]
staticYourPlatformAgnosticModuleName(){SecurityExtensionsModule.CreateSecuritySystemUser=Updater.CreateUser;}

where 'Updater.CreateUser' is your custom method that matches the following definition:

[C#]
publicdelegateIAuthenticationStandardUserCreateSecuritySystemUser(IObjectSpaceobjectSpace,stringuserName,stringemail,stringpassword,boolisAdministrator);

 

IMPORTANT NOTE
This module is currently ASP.NET only.

Question Comments

Added By: Daniele Bonetti at: 8/27/2012 3:14:19 PM    

downloaded and run the demo but i receive "Object reference not set to an instance of an object" error
xaf 12.1.5

Added By: octavia at: 9/24/2012 12:03:14 AM    

It can't be run. Object reference not set to an instance of an object" error

Added By: Santiago Moscoso at: 11/12/2012 3:39:21 PM    

On windows needs to invoke "EnsureShowViewStrategy" method from application, it's protected so you must use reflection.

On web I have problems with the action buttons not refreshing properly, must presh F5 to update buttons. (I'm working on 11.2.11)

Added By: Evgeniy Meyke at: 11/26/2012 4:59:41 AM    

Dennis, any chance to have this checked out soon?

   //Dennis: TODO
            //A possible issue in the framework - Controllers from ShowViewParameters are not added to the current Frame on the Web.
            //e.ShowViewParameters.Controllers.Add(CreateDialogController());

Added By: drew.. at: 3/9/2013 1:16:29 PM    

quick question before i begin integrating this: referring to the comment above " Include the module sources into your solution and rebuild it;" .. are you referring to the modules as listed below, or ALL the xaf modules?

Added By: drew.. at: 3/11/2013 10:12:45 AM    

.. for the benefit of others, this reference to "module" in #1 above, means to drop the entire Security.Extensions folder from the demo into your current solution that you want to update with the basic feature. Then add a reference from your platform-agnostic module (PAM) to the added project, rebuild, THEN go into the module designer for the PAM and drag-n-drop your newly added security module into the required modules section. Then rebuild again.

Added By: drew.. at: 3/11/2013 10:31:40 AM    

btw, i am in the process of integrating this with my DC-only based project. Once i have all the conversions done and tested i will likely post the project to help others save time.

Added By: Mario Blatarić at: 3/12/2013 1:59:10 AM    

Which parts make this module ASP.NET only? I don't understand what needs to be changed in order to make this work in WinForms as well. Any hints?

Added By: John01 at: 4/16/2013 8:10:38 AM    

Hi

When I run the example and click OK on register user I get the error 'Property 'Email' does not exist within type 'DevExpress.ExpressApp.Security.Strategy.SecuritySystemUser'.' on line user.SetMemberValue("Email", email) in function CreateUser. The email value is 'sam@example.com'. I did upgrade the project to 12.2.7 before running though. Any ideas?

Thanks

Regards

Added By: CArlos segura_1 at: 6/13/2013 1:22:53 PM    

someone has been to implement this?

Added By: Tony Tadros at: 9/5/2013 11:51:37 PM    

Hello Devexpress ,

having problem for some time downloading your examples
was thinking something wrong with my pc but tried some other still the same thing

ICAP Error (icap_error)

  
 An error occurred while performing an ICAP operation: Maximum file size exceeded; File: GetExample; Sub File: ManageUsersOnLogon.Module\BusinessObjects\ReadMe.txt; Vendor: Kaspersky Labs; Engine error code: 0x00000000; Engine version: 8.1.8.79; Pattern version: 130905.225000.10967985; Pattern date: 2013.09.05 22:50:00
 There could be a network problem, the ICAP service may be misconfigured, or the ICAP server may have reported an error.

 For assistance, contact your network support team.

Added By: Apostolis Bekiaris (DevExpress) at: 9/19/2013 3:35:30 AM    

Implemented in eXpandFramework 13.1.7.1
http://apobekiaris.blogspot.gr/2013/09/how-to-manage-users-register-new-user.html

Added By: Daniele M at: 7/26/2015 3:21:28 AM    

I would like to add a capctha code in this registration page.
how can i do? is there an example?
thanks

Added By: Dennis (DevExpress Support) at: 7/27/2015 2:46:05 AM    

@Daniele: While we do not have a ready E4037 example modification for this particular scenario, you can find the following ASP.NET documentation and reference tickets helpful:
ASPxCaptcha Overview
How to Validate a Captcha On Logon Screen
ASPxCaptcha in login page
How to: Use Custom Logon Parameters and Authentication

Should you experience any implementation difficulties, submit a separate ticket and attach your test project showing what you tried to implement according to this information.Added By: Daniele M at: 9/7/2015 7:31:28 AM    

is it possible to customize the logon form in order to obtain the logon button first of two rows with the button "forgot password" and "create a new user"?

Added By: Daniele M at: 9/7/2015 9:04:38 AM    

is it possible to change label to user name in register user form? I tried with displayname attribute in RegisterUserParameters,cs but it didn't work.
thanks

Added By: Dennis (DevExpress Support) at: 9/8/2015 2:43:16 AM    

@Daniele:
Both things are possible. The Security.Extensions module contains the Model.DesignedDiffs.xafml file with model customizations of the AuthenticationStandardLogonParameters_DetailView node. This node determines what your logon form will look like in the UI. You can customize its layout or change captions of items via the Model Editor designer. Should you experience any further customization difficulties here, please submit a separate ticket, and describe what you tried to do and what did not work as expected. Thanks.

Added By: Daniele M at: 9/25/2015 1:12:51 AM    

I can not integrate the example 3 with https://www.devexpress.com/Support/Center/Example/Details/E2849 to enforce password complexity.
can you help me?
thank you

Added By: Anatol (DevExpress Support) at: 9/25/2015 2:23:18 AM    

Hello Daniele,

To process your recent post more efficiently, I created a separate ticket on your behalf: T293660: How to integrate the E4037 and E2849 examples. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: MohammedFarooq at: 10/9/2015 5:33:10 PM    

Hi Dennis & Anatol,

I have used the is example in my project and it works great.

could you please show how to add an image (mylogo.png for example) on the right top corner of the logon page? It is a png image to show company's logo on the logon page.

Added By: Dennis (DevExpress Support) at: 10/12/2015 3:58:10 AM    @MohammedFarooq:
I am happy to hear of your progress.
>> how to add an image (mylogo.png for example) on the right top corner of the logon page?

Would you please submit a separate ticket and attach a screenshot of the desired UI, because possible solutions will vary a lot based on the exact logo placement?

Added By: MohammedFarooq at: 10/12/2015 8:54:03 AM    

Hi Dennis,

I have created a separate ticket as suggested by you.

https://www.devexpress.com/Support/Center/Question/Details/T299424

Added By: Vishwas Mokashi at: 12/24/2015 3:42:16 AM    

Hello,

I want to implement User Registration in our solution.

<<

Steps to implement
In order to use this module in your project, do the following:
1. Include the module sources into your solution and rebuild it;
>>

What are Module Sources ?  Module.cs?  LogonActionParameters.cs?, ManageUsersOnLogonController.cs? given in this ticket?
where and how to include it in solution?

Added By: Dennis (DevExpress Support) at: 12/24/2015 4:50:41 AM    @Vishwas: I have updated this instruction. Let me know in case of any further questions.Added By: Vishwas Mokashi at: 12/24/2015 6:21:21 AM    

Dennis, thanks I know how to include project but where from to down load?. Or I create new Module project and copy paste the code classes given in this ticket?

Added By: Dennis (DevExpress Support) at: 12/24/2015 6:31:24 AM    

@Vishwas: You can download complete example source code under the Downloads section at the right side of the example webpage. Let me know if you experience any further difficulties here.

Added By: Vishwas Mokashi at: 12/24/2015 6:36:55 AM    

Thanks Dennis, I had done that but problem was I did not have the Sample Runner loaded on my machine and could not extract the files.

Thank you and Merry Christmas!!

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:02:23 AM    @Vishwas: Am I correct that you have now installed the Example Runner and could download this example? If so,  I am happy to hear of your results.
Merry Xmas to you and yours too!Added By: Vishwas Mokashi at: 12/24/2015 7:14:39 AM    

Yes Dennis, I have Sample Runner, could download it and use it also. Thanks...

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:33:15 AM    @@Vishwas: Great!Added By: Ryan Elliott_ at: 5/23/2016 12:31:49 PM    where do I find the Security.Extensions module project?Added By: Dennis (DevExpress Support) at: 5/23/2016 12:35:54 PM    @Ryan: See the download link under the Downloads section on the right side of the example's page.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>