Need the registration to be done programatically, therefore to disable the registration page from browser access.
How this can be done?
Thanks
In the solution explorer right click the project then select
Add, New Scaffolded Item,
Select Identity on the right,
Check Account/Registration.
Add the DBcontext in the dropdown then click Add.
In the new Areas/Identity/Pages/Account/Register.cshtml at the top put
#{
// Stop users registering
Response.Redirect("/");
ViewData["Title"] = "Register";
}
Then you will need to remove all the links in other files to registration page.
Related
.Net Core 6, MVC, and your basic authentication with Identity set up (which is RazorPages only), but I want my Home/Index.cshtml page to "host" the Identity/Account/Login page, preferably without having to resort to an iFrame.
Everything I've seen so far is simply how to build the Login page, but nothing on how to put the page somewhere besides its default location.
How do I put the Login form/page on my MVC Home/Index.cshtml page?
How do I put the Login form/page on my MVC Home/Index.cshtml page
Login page is a razor page not a partial view, so you cannot use <partial> to add Login page in the Index view. You can put your code for login in the Index.cshtml, but you may need change a lot, like building the Login page.
If you add below code in the _layout, so that you can login at any view you want.
<partial name="_LoginPartial" />
result:
I am new to Sitefinity and looking for a solution to create a custom password protected page that prompts used first with a password form and if successful, would display the content on the page.
That's a standard functionality of the CMS - just create the page and then from the Actions menu select Set Permissions and there you can set that only Authenticated users (or any other role) can have View access to the page.
I am using IdentityServer template is4aspid, which comes with asp.net identity, I would like to add a register page to it. I don't want to do it on my main MVC app as I don't want it to have access to the users DB, and hence the identityServer already has that reference, I thought it would be better to just add the registration step to it.
I copied the Register.cshtml page from another asp.net webapplication, where I scafolded the identity, but when I click on register, nothing happens, not sure what is happening
.
As you can see in the picture above, after clicking on the Register link, the url changes to the one supposed to provide the registration form, but the page remains the same of the login form.
I added the following line to _Layout.cshtml
i'm working on a Joomla web site where i would like to change the default authentication page.
i created a new login menu item and i've tried to hide the com content area so that the login form don't show. instead of the default login form i placed a new better looking login module.
now i'm trying to make this page the default login page.
There are a couple areas in the site where access is restricted to registered users. and if clicked it leads to the default joomla login page. i want the user to be redirected to login from the new one.
can you please help?
The easiest way to obtain your own custom login page is to override the default joomla layout template.
It's actually very easy to do.
Start with your template. In the template directories, you'll need to have an html folder in your template. Inside of that, you'll need a com_users directory, and inside of that - a login folder. Like this:
/templates/YOURTEMPLATE/html/com_users/login
Then, copy /components/com_users/views/login/tmpl/default_login.php into your new login folder you just created.
From here, you can customize the default_login.php file to your hearts content. Be sure to keep the field names and hidden fields intact - be sure to only manipulate layout elements and avoid changing anything to do with the form, form name, destination or fields.
You can do the same for the logout template - and as a bonus, it goes in the same folder in your template.
In Sitecore I have denied access to a particular page for the anonymous user.
This works correctly, but it also means that the page does not appear in the navigation menus and sitemap (both XSLT).
What I would like is for the user to be able to see the link, but be redirected to a Register/Login page when they click on it.
You'd need to allow anonymous users to view the page for it to be visible in the menu and sitemap.
What you could do though is override the Sitecore.Pipelines.HttpRequest.HttpRequestProcessor to check if the page requires a login (by adding a RequiresLogin True/False to the template for example), then check if the user is logged in if not redirect to your login page.
Theres an example of overriding the HttpRequestProcessor here
You could wrap the rendering logic in the menus in a SecurityDisabler, so it would render all item links, even if the user "cant see" them.
using (SecurityDisabler disabler = new SecurityDisabler())
{
foreach (Item item in Sitecore.Context.Item.Children)
{
... render the link ...
}
}