#pragma checksum "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\LoginFeatures\Account\Pages\SignIn.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4cb08f787717c1fec28943109e00f0faaface76d"
// <auto-generated/>
#pragma warning disable 1591
#pragma warning disable 0414
#pragma warning disable 0649
#pragma warning disable 0169

namespace SPWA.LoginFeatures.Account.Pages
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Components;
#nullable restore
#line 2 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA.Shared;

#line default
#line hidden
#nullable disable
#nullable restore
#line 11 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using MatBlazor;

#line default
#line hidden
#nullable disable
#nullable restore
#line 12 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using BlazorInputFile;

#line default
#line hidden
#nullable disable
#nullable restore
#line 13 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Identity;

#line default
#line hidden
#nullable disable
#nullable restore
#line 14 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.DataProtection;

#line default
#line hidden
#nullable disable
#nullable restore
#line 15 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA.LoginFeatures.Account.Pages.GoogleLogin;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\LoginFeatures\Account\Pages\SignIn.razor"
using SPWA.LoginFeatures.Account.Shared;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\LoginFeatures\Account\Pages\SignIn.razor"
using SPWA.DataAccess.Data;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\LoginFeatures\Account\Pages\SignIn.razor"
using System.ComponentModel.DataAnnotations;

#line default
#line hidden
#nullable disable
    [Microsoft.AspNetCore.Components.LayoutAttribute(typeof(SigninLayout))]
    [Microsoft.AspNetCore.Components.RouteAttribute("/Account/SignIn")]
    public partial class SignIn : Microsoft.AspNetCore.Components.ComponentBase
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
        }
        #pragma warning restore 1998
#nullable restore
#line 91 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\LoginFeatures\Account\Pages\SignIn.razor"
                   

                private SignInModel signInModel = new SignInModel();
                private bool showSignInError = false;


                private async Task RegisterUser()
                {
                    var user = await userManager.FindByEmailAsync(signInModel.Email);

                    if (user != null && await userManager.CheckPasswordAsync(user, signInModel.Password))
                    {
                        showSignInError = false;

                        var token = await userManager.GenerateUserTokenAsync(user, TokenOptions.DefaultProvider, "SignIn");

                        var data = $"{user.Id}|{token}";

                        var parsedQuery = System.Web.HttpUtility.ParseQueryString(new Uri(navigationManager.Uri).Query);

                        var returnUrl = parsedQuery["returnUrl"];

                        if (!string.IsNullOrWhiteSpace(returnUrl))
                        {
                            data += $"|{returnUrl}";
                        }

                        var protector = dataProtectionProvider.CreateProtector("SignIn");

                        var pdata = protector.Protect(data);

                        navigationManager.NavigateTo("/account/signinactual?t=" + pdata, forceLoad: true);
                    }
                    else
                    {
                        showSignInError = true;
                    }
                }

                public class SignInModel
                {
                    [Required]
                    public string Email { get; set; }
                    [Required]
                    public string Password { get; set; }
                }
            

#line default
#line hidden
#nullable disable
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private IDataProtectionProvider dataProtectionProvider { get; set; }
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private NavigationManager navigationManager { get; set; }
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private SignInManager<ApplicationUser> signInManager { get; set; }
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private UserManager<ApplicationUser> userManager { get; set; }
    }
}
#pragma warning restore 1591
