Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit d5dacc3

Browse files
committed
I finally understand
Signed-off-by: Mateusz Bysiek <mb@mbdev.pl>
1 parent 9cddefb commit d5dacc3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

FileSyncWcfService/FileSyncService.svc.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,17 @@ public void AddUser(Credentials c, UserContents u) {
5050
public void Login(Credentials c) {
5151
using (filesyncEntitiesNew context = new filesyncEntitiesNew()) {
5252
try {
53-
User u1 = (from u in context.Users
54-
where c.Equals(u.user_login, u.user_pass)
55-
select u).Single();
5653
//User u1 = (from u in context.Users
57-
// where c.Login == u.user_login && c.Password == u.user_pass
54+
// where c.Equals(u.user_login, u.user_pass)
5855
// select u).Single();
56+
User u1 = context.Users.Where(u => u.user_login == c.Login).SingleOrDefault();
57+
58+
if (u1 == null)
59+
{
60+
}
61+
//(from u in context.Users
62+
// where c.Login == u.user_login && c.Password == u.user_pass
63+
// select u).Single();
5964

6065
UpdateLastLogin(context, LoginToId(context, c.Login));
6166
} catch (Exception ex) {
@@ -161,8 +166,11 @@ private void UpdateLastLogin(filesyncEntitiesNew context, int id) {
161166

162167
private bool Authenticate(filesyncEntitiesNew context, Credentials c) {
163168
try {
169+
//User u1 = (from u in context.Users
170+
// where c.Equals(u.user_login, u.user_pass)
171+
// select u).Single();
164172
User u1 = (from u in context.Users
165-
where c.Equals(u.user_login, u.user_pass)
173+
where c.Login == u.user_login && c.Password == u.user_pass
166174
select u).Single();
167175
} catch {
168176
return false;

0 commit comments

Comments
 (0)