MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Where do i find this  (Mono Support )

Viewed 7048 time(s), 6 post(s) 4/16/2015 9:33:36 AMby TomSproet
TomSproet

TomSproet

4/16/2015 9:33:36 AM
Hey,
You may remember me from an earlier support question regarding NuGet. http://monox.mono-software.com/Mono/Pages/Discussion/dtopic/F8wRww8wck-zHKRtALF31g/Error-when-installing-trough-NuGet/

Now i have a microsoft server with monox installed and its running great.
As you can imagine i want to edit the default portal site to fit my needs, except im having some trouble only 5 minutes in.

I logged on to the website using the admin account and went into design mode. added a login form and saved the changes. however it shows this login form to everyone not just visitors that have yet to login. i couldnt find the setting to change this in the module settings http://puu.sh/hfNHd/920ed2a6b4.png it seems i can only say what users can see and there is no checkbox for visitors by default (the one you see is a custom group created by me to check if it would work). is there a way i can achieve this?

just to summarize the end goal:
The landing page shows a header + login form + footer to a visitor / not logged in user.
To a logged in user it shows header + content + footer.

Thanks in advance

This content has not been rated yet. 
62 Reputation 8 Total posts
imarusic

imarusic

4/16/2015 10:04:27 AM
Hi,

you can solve it by redirecting the  logged in user to the  "header + content + footer" page. So you should have two pages, one(with content) for logged in user and other(login module) for the visitor.

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
TomSproet

TomSproet

4/16/2015 10:56:44 AM
However if you do that and the logged in user types the url to home again he will land on the default page which is the one with the login form. Or is there a possibiliity to change an item in the menu based on login status?


---EDIT
Would it be viable to go into the code of the login form and get an if else statement in there that checks the current user(if there is no current user that means he is not logged in ) or would that not be adviseable
This content has not been rated yet. 
62 Reputation 8 Total posts
imarusic

imarusic

4/16/2015 11:02:06 AM
Hi,

login page should have redirect logic. And even if the logged in user types "login page" url he will be redirected to other page..

Yes, you can set the visibility of the MonoX menu item in the administration. Take a look at the attached screenshot. The idea is that each logged/registered user is set to the appropriate role. Therefore you can use that role to filter users which can see the menu item.

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts
TomSproet

TomSproet

4/16/2015 11:13:10 AM
I understand that the login page has redirect logic but im not using the login page, i have added a login field module to the landing page and using that. with " the logged in user types the url to home again" i ment that the user goes to the base url www.mysite.foo. by doing so he lands on the landing page wich has the login field module. even if he is still logged in in the current session.

The screenshot did help with editing the menu thanks for that.

Also im seeing Codebehind="LoginModule.ascx.cs"  in every module but then visual studio says this file cannot be found. i imagine these to be the actual controller behind the view page. are these only accessable if you have the source version?
This content has not been rated yet. 
62 Reputation 8 Total posts
imarusic

imarusic

4/17/2015 6:38:34 AM
Hi,

if you do not want to have separate login page and handle redirects(you want login module on home page which is visible depending on the current user) you should register login module control in your page markup and handle the visibility logic in the  code behind(.cs file).

If you are using existing MonoX page you should add the code behind file(that means extend the existing page/control) and handle visibility logic there. An example "OnPreRender" page event.

Source code edition allows you to take advantage of the .cs files. Free version does not contain .cs files, but you can still extend the existing functionality. Click here for an example on how to do it.

Regards.
This content has not been rated yet. 
3016 Reputation 428 Total posts