Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# bart_s 4/30/2009 12:23 PM
New created user with role "Authenticated user" can login to admin panel of site. Why?
How restrict all users, except admin, to login to admin panel?
# Constructor 4/30/2009 10:30 PM
Are both 'Administrator' and 'Authenticated user' ticked in the 'Roles' section of the 'Edit User' page in the admin?

That is all I can think of as I have never experienced this before.
# bart_s 5/1/2009 4:41 PM
No, new registered user is ticked only as 'Authenticated user'.
I think it is a bug and can be fixed in Login.aspx.cs in the following finction:


private void btnLogin_Click(object sender, System.EventArgs e)
{
AuthenticationModule am = (AuthenticationModule)this.Context.ApplicationInstance.Modules["AuthenticationModule"];
if (am.AuthenticateUser(txtUsername.Text, txtPassword.Text, false) && this.User.IsInRole("Administrator"))
{
Context.Response.Redirect(FormsAuthentication.GetRedirectUrl(this.User.Identity.Name, false));
}
else
{
this.lblError.Text = "Invalid username or password.";
this.lblError.Visible = true;
}
}



The Red code is FIX of the bug.
Is it correct method or not?
# martijnb 5/2/2009 10:20 AM
No, this is not correct. The login page is also used sometimes for front-end pages.

Please check the permissions on your site. The admin pages inherit from AdminBasePage and only roles with AccessLevel Administrator should be able to access these pages. Probably, the Authenticated User role has a little bit too much rights.
# bart_s 5/2/2009 5:09 PM
Here is the scenario:
1. Anonymus registering on my site via User module
2. After registration he got an email with password (via admin panel I can see his role - only 'Authenticated user' is checked, Editor and Administrator is blank)
3. New registered user go to http://mysite/admin page enter his username and password and granted access to admin panel

What is wrong with my permissions in this scenario?
# martijnb 5/3/2009 2:25 PM
Go to 'Manage roles' and check the permissions for the Authenticated user roles. Only 'Authenticated' should be checked and 'Administrator' certainly not.