Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
Is there a way, in which I can use login information from Couch CMS DB for a authenticated user to create a members login form, which redirects the user to a specific page that needs to be logged in to be viewed?

Hopefully this makes sense. Any help would be greatly appreciated.
Hi,

If you place the following somewhere in the 'specific page that needs to be logged in to be viewed' you mentioned, I think it'll do exactly what you said (please let me know if i misunderstood the question, however).
Code: Select all
<cms:if k_logged_out >
    <cms:redirect k_login_link />
</cms:if>
Thanks KK.. Yeah kind of the answer I was looking for..

Although what I really need is..

Ive created my own custom login form for members, what I would like to do is setup authenticated users in couchcms (which I have done) and then be able to use those details as logins for the custom designed form.

I have used the below login form but it still sends the user to the admin area to login then back again

Code: Select all
<form name="frm_login" action="<cms:show k_login_link />" method="post">
      <input type="hidden" name="url_hash" value="">

      <div class="control-group">
         <div class="controls">
                        <input type="text"  id="k_user_name" name="k_user_name" class="input-xlarge" placeholder="Username">
         </div>
      </div>
      <div class="control-group">
         <div class="controls">
            <input type="password" id="k_user_pwd" name="k_user_pwd" class="input-xlarge" placeholder="Password">
         </div>
      </div>
      <div class="control-group">
         <div class="controls">
            <button type="submit" name="k_login">Sign In</button>
         </div>
      </div>
   </form>


Is there a way to use the credentials without the couchcms login, then the redirect be to another page?? lets say members.php?

Hopefully this makes a little more sense. :)
Please add a value attribute to your submit button:
Code: Select all
<button name="k_login" type="submit" value="1">Sign In</button>

Let us know if this works :)
Thanks Cheesypoof.. that has fixed the login problem...

Now is there a way to make the page redirect once logged in?
or is it possible to create a new / additional login.php which redirects once login and if the login is incorrect doesn't go to couchcms admin panel login??

Thanks again for the help!
Actually got it working by using the below code for the login page

Code: Select all
<cms:if k_logged_in >
    <cms:redirect url='secure_site_address' />
</cms:if>


Then on the Secure sites I used the below code to redirect the user back to the Login form

Code: Select all
<cms:if k_logged_out >
    <cms:redirect url='login_page_address' />
</cms:if>


Pretty happy with the result, as I can now setup a members area in the back end using authenticated users.. :)

The only problem left is the redirect on the login form if the user gets the wrong password.. not sure what to do with that.

Thanks again for the help
@DoggaBreff,

Don't know if it'd be feasible for you but if you could wait for just a couple of days you can use the new 'Members' addon that we are about to release.

It has all the functions that you'd expect from a proper user module and, of course, can be used with your own design.
@kk

haha! that's great, I will change it over as soon as it is released.. Thanks! :)
8 posts Page 1 of 1