Page 1 of 1

Login/Logout pop-ups

Posted: Thu Oct 17, 2013 9:49 am
by mwilk
We have our own login screen.

When a user logs in, or out, there is a "Login/Logout Success" dialog that pops up.

Because we have controls on the HMI that become visible/invisible depending on the user level, the user already gets feedback that indicates success.

How can I turn on/off those "Login/Logout Success" messages?

Thanks.

Re: Login/Logout pop-ups

Posted: Thu Oct 17, 2013 9:53 am
by mark.monroe
There is no way to turn off that message.

Re: Login/Logout pop-ups

Posted: Thu Oct 17, 2013 10:18 am
by mwilk
mark.monroe wrote:There is no way to turn off that message.
OK, thanks for the info.

Re: Login/Logout pop-ups

Posted: Fri Oct 18, 2013 11:27 am
by Edmund
I believe that you can get rid of the "Login Success" by creating your own custom login.

Code: Select all

void Button1_Click(System.Object sender, System.EventArgs e)
{
    Globals.Security.Login("Administrator", "1234");
}
The code above will login the administraor without any message.

But calling the Globals.Security.Logout(); will show the logout message :?

BR.

Re: Login/Logout pop-ups

Posted: Fri Oct 18, 2013 2:21 pm
by mwilk
Hmm.

I'll have to think about that, but I doubt I'll go through the trouble of creating a custom login.

Re: Login/Logout pop-ups

Posted: Sat Oct 19, 2013 7:28 am
by Edmund
well, here is a super light login function anyway

Code: Select all


namespace Neo.ApplicationFramework.Generated
{
    using System.Windows.Forms;
    using System;
    using System.Drawing;
    using Neo.ApplicationFramework.Tools;
    using Neo.ApplicationFramework.Common.Graphics.Logic;
    using Neo.ApplicationFramework.Controls;
    using Neo.ApplicationFramework.Interfaces;
	using Neo.ApplicationFramework.Common.Service;
	using Neo.ApplicationFramework.Common.Utilities;
    
	public partial class Screen1
	{
		
		void Screen1_Opened(System.Object sender, System.EventArgs e)
		{
			// Get all users
			ISecurityManager securityManager = Globals.Security as ISecurityManager;
			foreach (ISecurityUser user in securityManager.Users)
				cboUsers.Items.Add(user.Username);
		}
		
		void Button1_Click(System.Object sender, System.EventArgs e)
		{
			// Get current username
			var currentUser = Globals.Security.CurrentUser;
		
			// Try to login
			Globals.Security.Login(cboUsers.Text, txtPassword.Text);
			
			// Check if the username was changed
			if(currentUser != Globals.Security.CurrentUser)
				MessageBox.Show("Login OK");
			else
				MessageBox.Show("Login Failed");
		}
		
		void Button2_Click(System.Object sender, System.EventArgs e)
		{
			// Logout
			Globals.Security.Logout();
		}
	}
}


The screen contains two buttons (login/logout), one ComboBox for users (cboUsers) and one text field for password (txtPassword).

BR.