74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
using AppData;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
|
|
namespace CompanyRegistration.WebUserControls
|
|
{
|
|
public partial class cmp_userRegistration : System.Web.UI.UserControl
|
|
{
|
|
protected DataLayer dl = new DataLayer();
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected string email
|
|
{
|
|
get
|
|
{
|
|
return txtEmail.Text.Trim();
|
|
}
|
|
}
|
|
|
|
protected void lbtSubscribe_Click(object sender, EventArgs e)
|
|
{
|
|
// check login esistente
|
|
var userFound = dl.taAnagUsers.getByKey(txtEmail.Text.Trim());
|
|
if (userFound == null || userFound.Count == 0)
|
|
{
|
|
lblError.Visible = false;
|
|
lbtReset.Visible = false;
|
|
// registro su DB
|
|
var newRecord = dl.taAnagUsers.insertNew(email, txtFirstName.Text.Trim(), txtLastName.Text.Trim());
|
|
string token = "###";
|
|
if (newRecord != null && newRecord.Count == 1)
|
|
{
|
|
token = newRecord[0].saltSeed;
|
|
}
|
|
// invio email x pwd reset
|
|
string oggetto = "reset password utente piattaforma SmartCheckIn";
|
|
string corpo = $"Buongiorno<br/>Prego cliccare sul <a href=\"http:////seriate.steamware.net:8083//SmartCheckIn//User//resetPwd?email={email}&token={token}\">link seguente</a> per effettuare il reset della password associata alla tua email per la piattaforma smartcheckin.site";
|
|
AppData.utility.inviaEmail(txtEmail.Text.Trim(), oggetto, corpo, 1);
|
|
}
|
|
else
|
|
{
|
|
// errore email già esistente
|
|
lblError.Visible = true;
|
|
lblError.Text = "Errore: email già esistente, se vuoi resettare password prego premi sul pulsante in calce";
|
|
lbtReset.Visible = true;
|
|
}
|
|
}
|
|
|
|
protected void lbtReset_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
var userFound = dl.taAnagUsers.getByKey(txtEmail.Text.Trim());
|
|
if (userFound != null || userFound.Count == 1)
|
|
{
|
|
string token = userFound[0].saltSeed;
|
|
// invio email x pwd reset
|
|
string oggetto = "reset password utente piattaforma SmartCheckIn";
|
|
string corpo = $"Buongiorno<br/>Prego cliccare sul <a href=\"http:////seriate.steamware.net:8083//SmartCheckIn//User//resetPwd?email={email}&token={token}\">link seguente</a> per effettuare il reset della password associata alla tua email per la piattaforma smartcheckin.site";
|
|
AppData.utility.inviaEmail(txtEmail.Text.Trim(), oggetto, corpo, 1);
|
|
// nascondo errore
|
|
lblError.Visible = false;
|
|
lbtReset.Visible = false;
|
|
}
|
|
}
|
|
}
|
|
} |