Customizing login and other account ui MVC
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
You can easily override the UI of Turnkey and custom-built web apps using the MDriven.ASPNETIdentity implementation by following this strategy. | You can easily override the UI of Turnkey and custom-built web apps using the MDriven.ASPNETIdentity implementation by following this strategy. | ||
* This is explained in the context of MDriven Turnkey but will follow the same pattern for other applications using MDriven.ASPNETIdentity. | |||
This is explained in the context of MDriven Turnkey but will follow the same pattern for other applications using MDriven.ASPNETIdentity. | |||
# Remember that the Account controller has different implementations for MVC4(.net5+) and MVC4 (framework 4.7). The override behaves the same for both controllers (AccountControllerBase and AccountControllerBaseForCore) - but views differ slightly. Using core views on Framework will probably not work well and vice versa. | # Remember that the Account controller has different implementations for MVC4(.net5+) and MVC4 (framework 4.7). The override behaves the same for both controllers (AccountControllerBase and AccountControllerBaseForCore) - but views differ slightly. Using core views on Framework will probably not work well and vice versa. | ||
# The controller has been given a new string property '''AccountOverride'''. If this is assigned, all account cshtml views will be sought after first in Views/Account/EXT_AccountOverride/<AccountOverride-value> | # The controller has been given a new string property '''AccountOverride'''. If this is assigned, all account cshtml views will be sought after first in Views/Account/EXT_AccountOverride/<AccountOverride-value> | ||
# If the sought-after UI is not found in the override position, the standard position will be used: Views/Account. This is also true if AccountOverride is null or empty.[[File:2022-03-08 18h56 00.png|none|thumb|385x385px]]In the image above, the Login and Register have been overridden and will come into play only if the AccountController.AccountOverride == "test" (since the folder is named test). | # If the sought-after UI is not found in the override position, the standard position will be used: Views/Account. This is also true if AccountOverride is null or empty.[[File:2022-03-08 18h56 00.png|none|thumb|385x385px]]In the image above, the Login and Register have been overridden and will come into play only if the AccountController.AccountOverride == "test" (since the folder is named test). | ||
# In MDriven Turnkey, | # In MDriven Turnkey, give a value to AccountController.AccountOverride by implementing a string attribute on SysSingleton:[[File:2022-03-08 19h00 12.png|none|thumb|355x355px]] | ||
# | #*By using different means to give value to SysSingleton.AccountOverride, you can influence what override folder of possibly many (test, consumer, admin, or whatever else) you want to show to a user interacting with any of the many views of the account controller. | ||
#To get the override UI distributed and applied to your server, we suggest you use the [[AssetsTK]] strategy | #To get the override UI distributed and applied to your server, we suggest you use the [[AssetsTK]] strategy. | ||
=== Example: === | === Example: === |
Revision as of 08:28, 15 June 2023
You can easily override the UI of Turnkey and custom-built web apps using the MDriven.ASPNETIdentity implementation by following this strategy.
- This is explained in the context of MDriven Turnkey but will follow the same pattern for other applications using MDriven.ASPNETIdentity.
- Remember that the Account controller has different implementations for MVC4(.net5+) and MVC4 (framework 4.7). The override behaves the same for both controllers (AccountControllerBase and AccountControllerBaseForCore) - but views differ slightly. Using core views on Framework will probably not work well and vice versa.
- The controller has been given a new string property AccountOverride. If this is assigned, all account cshtml views will be sought after first in Views/Account/EXT_AccountOverride/<AccountOverride-value>
- If the sought-after UI is not found in the override position, the standard position will be used: Views/Account. This is also true if AccountOverride is null or empty.In the image above, the Login and Register have been overridden and will come into play only if the AccountController.AccountOverride == "test" (since the folder is named test).
- In MDriven Turnkey, give a value to AccountController.AccountOverride by implementing a string attribute on SysSingleton:
- By using different means to give value to SysSingleton.AccountOverride, you can influence what override folder of possibly many (test, consumer, admin, or whatever else) you want to show to a user interacting with any of the many views of the account controller.
- To get the override UI distributed and applied to your server, we suggest you use the AssetsTK strategy.
Example:
This page was edited more than 8 months ago on 05/02/2024. What links here