using SteamWare;
using System;
namespace CMS_SC.WebUserControls
{
public partial class mod_enrollUserBase : SteamWare.UserControl
{
///
/// richiesta enroll device da chiave personale + email
///
///
///
protected void btnEnrollByAK_Click(object sender, EventArgs e)
{
if (email != "")
{
// ora controllo che l'email SIA nell'elenco delle email degli utenti...
if (devicesAuthProxy.stObj.checkUserEmail(email))
{
// controllo se l'utente è "base" --> NumAuth = 0 e quindi posso fare auth "semplificata"...
if (devicesAuthProxy.stObj.numAuth(email)==0)
{
// salvo i dati MINIMI per auth utente (in sessione) SENZA cookie...
setupUserBase();
Response.Redirect("Default");
}
else
{
lblOutMsg.Text = traduci("ErrorEAK04");// "Attenzione: profilo utente non corretto per accesso Collaudatore";
lblOutMsg.Visible = true;
}
}
else
{
lblOutMsg.Text = traduci("ErrorEAK05");// "Attenzione! email non trovata, prego contattare amministratore!";
lblOutMsg.Visible = true;
}
}
else
{
lblOutMsg.Text = traduci("ErrorEAK03");//"Attenzione! preogo inserire email valida!";
lblOutMsg.Visible = true;
}
}
///
/// email da cognome/nome inseriti
///
protected string email
{
get
{
string answ = "";
// leggo cognome / nome x controllare email cms nome.cognome@cms.it ...
string cognome = txtCognome.Text.Trim().ToLower();
string nome = txtNome.Text.Trim().ToLower();
if (cognome != "" && nome != "")
{
try
{
answ = string.Format("{0}.{1}@cms.it", nome, cognome);
}
catch
{ }
}
return answ;
}
}
///
/// setup cookie e dati vari x utente base (solo collaudo)
///
private void setupUserBase()
{
// crea un valore cookie usando cookieStdSalt
string cookieVal = devicesAuthProxy.encodeKey(email);
// salvo il cookie nel browser x 2 anni
memLayer.ML.setCookieVal(devicesAuthProxy.AuthCookieName, cookieVal, DateTime.Now.AddMonths(memLayer.ML.CRI("defMonthScadUserBase")));
}
}
}