Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserId object was passed to DAL rather than a key #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Source/VidPub.Web/App_Data/DBScripts.sql
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/VidPub.Web/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ActionResult Register(string Email, string Password, string Confirm) {

var result = _users.Register(Email, Password, Confirm);
if (result.Success) {
SetToken(result.UserID);
SetToken(result.UserID.ID);
return RedirectToAction("Index", "Home");
} else {
ViewBag.Message = result.Message;
Expand Down
7 changes: 5 additions & 2 deletions Source/VidPub.Web/Model/Users.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Dynamic;
Expand All @@ -20,7 +21,9 @@ public dynamic Register(string email, string password, string confirm) {
result.UserID = this.Insert(new { Email = email, HashedPassword = Hash(password) });
result.Success = true;
result.Message = "Thanks for signing up!";
} catch (SqlCeException ex) {
} catch (Exception ex)
{
if (ex is SqlCeException || ex is SqlException)
result.Message = "This email already exists in our system";
}
} else {
Expand Down