Hi there,
I’m fairly new to MODx and need to password protect a section of a site. I’ve searched through the MODx forums and Googled ’modx web login’ but couldn’t find anything useful that lists the steps necessary to implement password protection.
From what I’ve been able to pick up on, I’ve done the following:
I. In MODx manager:
A. I create a document group called ’employee_docs’ under Security > Web Permissions > Document Groups
B. I assign the folder that I want to protect to this ’employee_docs’ group, ie, I have a container document called ’Employee Area’. I edit its General properties > Access Permissions by assigning it to the ’employee_docs’ group
C. I create a web group called ’employees’ under Security > Web Permissions > Web User Groups
D. I create a web user called ’employee’ under Security > Web Users and assign the the user to the ’employees’ web group
E. In the ’Employee Area’ page, I copy the following WebLogin snippet code into the content field:
[!WebLogin? &tpl=`FormLogin` &loginhomeid=`29`!]
where ’29’ is the id of this container page
F. the FormLogin template/chunk code is copied directly from the MODx sample site chunk:
<!-- #declare:separator <hr> -->
<!-- login form section-->
<form method="post" name="loginfrm" action="[+action+]">
<input type="hidden" value="[+rememberme+]" name="rememberme" />
<fieldset>
<h3>Your Login Details</h3>
<label for="username">User: <input type="text" name="username" id="username" tabindex="1" onkeypress="return webLoginEnter(document.loginfrm.password);" value="[+username+]" /></label>
<label for="password">Password: <input type="password" name="password" id="password" tabindex="2" onkeypress="return webLoginEnter(document.loginfrm.cmdweblogin);" value="" /></label>
<input type="checkbox" id="checkbox_1" name="checkbox_1" tabindex="3" size="1" value="" [+checkbox+] onclick="webLoginCheckRemember()" /><label for="checkbox_1" class="checkbox">Remember me</label>
<input type="submit" value="[+logintext+]" name="cmdweblogin" class="button" />
<a href="#" onclick="webLoginShowForm(2);return false;" id="forgotpsswd">Forget Your Password?</a>
</fieldset>
</form>
<hr>
<!-- log out hyperlink section -->
<h4>You're already logged in</h4>
Do you wish to <a href="[+action+]" class="button">[+logouttext+]</a>?
<hr>
<!-- Password reminder form section -->
<form name="loginreminder" method="post" action="[+action+]">
<fieldset>
<h3>It happens to everyone...</h3>
<input type="hidden" name="txtpwdrem" value="0" />
<label for="txtwebemail">Enter the email address of your account to reset your password: <input type="text" name="txtwebemail" id="txtwebemail" size="24" /></label>
<label>To return to the login form, press the cancel button.</label>
<input type="submit" value="Submit" name="cmdweblogin" class="button" /> <input type="reset" value="Cancel" name="cmdcancel" onclick="webLoginShowForm(1);" class="button" style="clear:none;display:inline" />
</fieldset>
</form>
I thought this might come close to what I need to accomplish, but when I try to access the ’Employee Area’ page, I get the contents of the [{start page}].
Any clues what I’m missing or can you point me to a good tutorial on how to implement password protection via MODx?
thanks!