You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Microsoft.AspNet.Identity;
|
|
using Microsoft.AspNet.Identity.Owin;
|
|
using System.Threading.Tasks;
|
|
using WebFormApp.Models;
|
|
|
|
namespace WebFormApp.Account
|
|
{
|
|
public partial class AddPhoneNumber : System.Web.UI.Page
|
|
{
|
|
protected void PhoneNumber_Click(object sender, EventArgs e)
|
|
{
|
|
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
|
|
var code = manager.GenerateChangePhoneNumberToken(User.Identity.GetUserId(), PhoneNumber.Text);
|
|
if (manager.SmsService != null)
|
|
{
|
|
var message = new IdentityMessage
|
|
{
|
|
Destination = PhoneNumber.Text,
|
|
Body = "Ihr Sicherheitscode lautet " + code
|
|
};
|
|
|
|
manager.SmsService.Send(message);
|
|
}
|
|
|
|
Response.Redirect("/Account/VerifyPhoneNumber?PhoneNumber=" + HttpUtility.UrlEncode(PhoneNumber.Text));
|
|
}
|
|
}
|
|
} |