Esempio n. 1
0
        public async Task <ExUserAccountDataResult> UserAccountData([FromBody] ExPostUserPasswortData userData)
        {
            Logging.Log.LogInfo($"UserAccountData {userData.UserId},{userData.PasswordHash}");
            using (var db = new Db())
            {
                var data = await db.TblUsers.FirstOrDefaultAsync(u => u.Id == userData.UserId);

                if (data == null)
                {
                    return(null);
                }

                if (data.Locked)
                {
                    return new ExUserAccountDataResult
                           {
                               IsLocked      = true,
                               PasswordWrong = false
                           }
                }
                ;

                if (data.Password != userData.PasswordHash && data.IsDemoUser == false)
                {
                    return new ExUserAccountDataResult
                           {
                               IsLocked      = false,
                               PasswordWrong = true
                           }
                }
                ;

                return(new ExUserAccountDataResult
                {
                    IsLocked = false,
                    PasswordWrong = false,
                    UserAccountData = new ExUserAccountData
                    {
                        FirstName = data.Firstname,
                        LastName = data.Lastname,
                        UserId = data.Id,
                        RestPasswort = data.RestPasswort,
                        DefaultUserLanguage = data.DefaultUserLanguage,
                        IsDemoUser = data.IsDemoUser,
                        IsAdmin = data.IsAdmin,
                        PhoneNumber = data.PhoneNumber,
                        Street = data.Street,
                        PostalCode = data.PostalCode,
                        City = data.City,
                    }
                });
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     2. Schritt Anmeldung => Passwort lokal gehashed und wird nun überprüft.
 /// </summary>
 /// <returns>Userdaten oder null wenn nicht verfügbar oder Passwort</returns>
 public async Task <ResultData <ExUserAccountDataResult> > UserAccountData(ExPostUserPasswortData userData)
 {
     return(await _wap.Post <ExUserAccountDataResult>("UserAccountData", userData));
 }