Exemplo n.º 1
0
        /* Change Password */
        public async Task<OpObject> EditPassword(String ChangeId, String NewPassword)
        {
            /* Create return object */
            IsolatedContext IsoContext = new IsolatedContext();

            /* Execute function */
            return await Execute(new Func<Task>(async () =>
            {
                /* Get user guid */
                String uGuid = "0";
                using (MaintienceRepository MainRepo = new MaintienceRepository())
                {
                    /* Delete */
                    uGuid = await MainRepo.DeleteCode(ChangeId);
                }

                /* Sanity */
                if (uGuid == "0")
                {
                    IsoContext.RetObj = new OpObject(StatusCode.InvalidParameters);
                    return;
                }

                /* Access user repo */
                using (UserRepository UserRepo = new UserRepository())
                {
                    /* Confirm the user */
                    IsoContext.RetObj = await UserRepo.EditPassword(uGuid, NewPassword);
                }
            }), IsoContext);
        }
Exemplo n.º 2
0
        /* Change Password */
        public async Task<OpObject> ChangePassword(String SessionId, String OldPassword, String NewPassword)
        {
            /* Create return object */
            IsolatedContext IsoContext = new IsolatedContext(SessionId);

            /* Execute function */
            return await Execute(new Func<Task>(async () =>
            {
                /* We need user repository for this */
                using (UserRepository UserRepo = new UserRepository())
                {
                    /* Does old password match? */
                    IsoContext.RetObj = await UserRepo.EditPassword(IsoContext.uGuid, OldPassword, NewPassword);
                }
            }), IsoContext);
        }